PHPackages                             s13k/php\_oklab\_color - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. s13k/php\_oklab\_color

ActiveLibrary

s13k/php\_oklab\_color
======================

Oklab, Okhsv and Okhsl — PHP8 implementation

1.0.0(3y ago)0169↓100%MITPHP

Since Jul 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/s0xDk/php_oklab_color)[ Packagist](https://packagist.org/packages/s13k/php_oklab_color)[ RSS](/packages/s13k-php-oklab-color/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

About
-----

[](#about)

- [A perceptual color space for image processing](https://bottosson.github.io/posts/oklab/)
- [Okhsv and Okhsl — Two new color spaces for color picking](https://bottosson.github.io/posts/colorpicker/)
- [Original C++ source (ok\_color.h)](https://bottosson.github.io/misc/ok_color.h)

Install
-------

[](#install)

`composer require s13k/php_oklab_color`

API
---

[](#api)

```
// Oklab
Oklab\OkColor::oklab_to_linear_srgb(float $L, float $a, float $b): array // [float $r, float $g, float $b]
Oklab\OkColor::linear_srgb_to_oklab(float $r, float $g, float $b): array // [float $L, float $a, float $b]

// Okhsl
Oklab\OkColor::okhsl_to_srgb(float $h, float $s, float $l): array // [float $r, float $g, float $b]
Oklab\OkColor::srgb_to_okhsl(float $r, float $g, float $b): array // [float $h, float $s, float $l]

// Okhsv
Oklab\OkColor::okhsv_to_srgb(float $h, float $s, float $v): array // [float $r, float $g, float $b]
Oklab\OkColor::srgb_to_okhsv(float $r, float $g, float $b): array // [float $h, float $s, float $v]
```

Example
-------

[](#example)

```
// Convert HSL (0–360°, 0–100%, 0–100%) to RGB hex
function okhsl_to_hex($h, $s, $l) {
    list($r, $g, $b) = Oklab\OkColor::okhsl_to_srgb($h % 360 / 360, $s / 100, $l / 100);
    return sprintf('#%02x%02x%02x', $r * 255, $g * 255, $b * 255);
}
echo okhsl_to_hex(137, 13, 37); #51594e
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1395d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2793078ca8959fb5de189242f20f8c8edaf752b1e8f0e2f9313a506e9775106?d=identicon)[s0xDk](/maintainers/s0xDk)

---

Tags

colorcolorspacesokhslokhsvoklabphp-librarycolorOklabOkhsvOkhsl

### Embed Badge

![Health badge](/badges/s13k-php-oklab-color/health.svg)

```
[![Health](https://phpackages.com/badges/s13k-php-oklab-color/health.svg)](https://phpackages.com/packages/s13k-php-oklab-color)
```

###  Alternatives

[league/color-extractor

Extract colors from an image as a human would do.

1.3k4.7M17](/packages/league-color-extractor)[spatie/color

A little library to handle color conversions

38018.9M28](/packages/spatie-color)[ksubileau/color-thief-php

Grabs the dominant color or a representative color palette from an image.

6353.8M38](/packages/ksubileau-color-thief-php)[mexitek/phpcolors

A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.

5003.6M18](/packages/mexitek-phpcolors)[kevinlebrun/colors.php

Colors for PHP CLI scripts

3426.7M44](/packages/kevinlebrun-colorsphp)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
