PHPackages                             kachnitel/color-converter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kachnitel/color-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kachnitel/color-converter
=========================

Lightweight PHP library for color format conversion (hex, RGB, HSL) and luminance calculation

v0.0.1(5mo ago)02731MITPHPPHP &gt;=8.2

Since Dec 5Pushed 5mo agoCompare

[ Source](https://github.com/kachnitel/frd-color-converter)[ Packagist](https://packagist.org/packages/kachnitel/color-converter)[ RSS](/packages/kachnitel-color-converter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Color Converter
===============

[](#color-converter)

Lightweight PHP library for color format conversion and luminance calculation.

Features
--------

[](#features)

- Convert hex colors to RGB
- Convert hex colors to HSL
- Determine if a color is light or dark based on luminance
- Pure PHP with no dependencies
- Fully tested

Installation
------------

[](#installation)

```
composer require kachnitel/color-converter
```

Usage
-----

[](#usage)

```
use Kachnitel\ColorConverter\ColorConverter;

$converter = new ColorConverter();

// Convert hex to RGB
$rgb = $converter->hex2rgb('#ff5733');
// ['r' => 255, 'g' => 87, 'b' => 51]

// Convert hex to HSL
$hsl = $converter->hex2hsl('#ff5733');
// ['h' => 11, 's' => 100, 'l' => 60]

// Check if color is light or dark
$isLight = $converter->isLight('#ff5733');
// false (dark color)

// Custom threshold for light/dark detection
$isLight = $converter->isLight('#ff5733', 70);
// true (with higher threshold)
```

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance72

Regular maintenance activity

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1206e3a106f8c82c1dd68d4304c951d6979f39e5806de2a7a72724d825f06b38?d=identicon)[kachnitel](/maintainers/kachnitel)

---

Top Contributors

[![kachnitel](https://avatars.githubusercontent.com/u/4067705?v=4)](https://github.com/kachnitel "kachnitel (2 commits)")

---

Tags

colorrgbconverterhexhslluminance

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kachnitel-color-converter/health.svg)

```
[![Health](https://phpackages.com/badges/kachnitel-color-converter/health.svg)](https://phpackages.com/packages/kachnitel-color-converter)
```

###  Alternatives

[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[spatie/color

A little library to handle color conversions

38018.9M28](/packages/spatie-color)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.2M9](/packages/tecnickcom-tc-lib-color)[ozdemirburak/iris

PHP library for color manipulation and conversion.

1201.7M16](/packages/ozdemirburak-iris)[fjw/color-compare

A library for converting colors (Hex, RGB, HSL, CIELAB (LAB), DIN-99) and calculating color distances based on DIN-99.

1310.0k](/packages/fjw-color-compare)

PHPackages © 2026

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