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(7mo ago)05281MITPHPPHP &gt;=8.2

Since Dec 5Pushed 7mo 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 today

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

34

—

LowBetter than 75% of packages

Maintenance65

Regular maintenance activity

Popularity17

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

210d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4067705?v=4)[Ondrej Vana](/maintainers/kachnitel)[@kachnitel](https://github.com/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.2M16](/packages/ssnepenthe-color-utils)[ozdemirburak/iris

PHP library for color manipulation and conversion.

1201.9M23](/packages/ozdemirburak-iris)[spatie/color

A little library to handle color conversions

38221.2M36](/packages/spatie-color)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

247.9M25](/packages/tecnickcom-tc-lib-color)[fjw/color-compare

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

1310.8k](/packages/fjw-color-compare)[delight-im/base-convert

Conversion of arbitrarily large numbers between any two bases or alphabets

161.5k](/packages/delight-im-base-convert)

PHPackages © 2026

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