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

Abandoned → [dragon-code/which-color](/?search=dragon-code%2Fwhich-color)Library[Utility &amp; Helpers](/categories/utility)

andrey-helldar/which-color
==========================

A simple helper, helping to determine what color the text will look better over a monotonous color.

4.1.0(8mo ago)82.8kMITPHPPHP ^8.2CI passing

Since Jul 25Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/TheDragonCode/which-color)[ Packagist](https://packagist.org/packages/andrey-helldar/which-color)[ Fund](https://boosty.to/dragon-code)[ Fund](https://yoomoney.ru/to/410012608840929)[ RSS](/packages/andrey-helldar-which-color/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (9)Dependencies (4)Versions (17)Used By (0)

What is the best text color?
============================

[](#what-is-the-best-text-color)

  ![Which Color](https://camo.githubusercontent.com/78a3346db80a1ddcb90a161e9d40761b54a45386d68b28da6f00c130333ba830/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5768696368253230436f6c6f722e706e673f7061747465726e3d746f706f677261706879267374796c653d7374796c655f3226666f6e7453697a653d3130307078266d643d312673686f7757617465726d61726b3d31267468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d647261676f6e2d636f646525324677686963682d636f6c6f72266465736372697074696f6e3d412b73696d706c652b68656c7065722532432b68656c70696e672b746f2b64657465726d696e652b776861742b636f6c6f722b7468652b746578742b77696c6c2b6c6f6f6b2b6265747465722b6f7665722b612b6d6f6e6f746f6e6f75732b636f6c6f722e26696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)A simple helper, helping to determine what color the text will look better over a monotonous color.

[![Stable Version](https://camo.githubusercontent.com/e5410b0b1a8ed8ee12ae320fb2303ecd56e1d7ef075ea25053f6169e65566331/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f546865447261676f6e436f64652f77686963682d636f6c6f723f6c6162656c3d737461626c65267374796c653d666c61742d737175617265)](https://packagist.org/packages/dragon-code/which-color)[![Total Downloads](https://camo.githubusercontent.com/26a7edaaadebf33b76206974ea328b827535fe33cf4e4c80ff5b00b4009f3b4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f647261676f6e2d636f64652f77686963682d636f6c6f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dragon-code/which-color)[![Github Workflow Status](https://camo.githubusercontent.com/a7a1f90f0628badfc50e4afe76a8d42a7ac10b90b37f6a783713386b5ba79407/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f546865447261676f6e436f64652f77686963682d636f6c6f722f706870756e69742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/TheDragonCode/which-color/actions)[![License](https://camo.githubusercontent.com/1d121c750b75b729f45a5c210764ff72c93cd7f1b5c22ed3d121af8031a3d0f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f647261676f6e2d636f64652f77686963682d636f6c6f722e7376673f7374796c653d666c61742d737175617265)](LICENSE)

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

[](#installation)

To get the latest version of package, simply require the project using [Composer](https://getcomposer.org):

```
composer require dragon-code/which-color
```

Instead, you may of course manually update your require section and run `composer update` if you so choose:

```
{
    "require": {
        "dragon-code/which-color": "^4.0"
    }
}
```

Using
-----

[](#using)

The package helps to determine what color it is better to write text over a monotonous color.

```
use DragonCode\WhichColor\Facades\Color;

return Color::of('#000000')->lightIsBetter(); // returned `true`. A white text color is better for black background.
return Color::of('#ffffff')->darkIsBetter(); // returned `true`. A black text color is better for white background.

return Color::of('#ffffff')->lightIsBetter(); // returned `false`. White color is not the best for white background.
return Color::of('#000000')->darkIsBetter(); // returned `false`. Black color is not the best for black background.
```

You can also use the converter:

```
use DragonCode\WhichColor\Services\Converter;

$converted = new Converter();

$rgb = $converted->hex2rgb('#fa000a'); // RGB object with [250, 0, 10]
// $rgb->red; // 250
// $rgb->green; // 0
// $rgb->blue; // 10
// $rgb->toArray(); // [250, 0, 10]

$converted->hex2rgb('#f5a'); // RGB object with [255, 85, 170]
$converted->hex2rgb('#ff55aa'); // RGB object with [255, 85, 170]

$converted->rgb2hex($rgb); // '#fa000a'
$converted->rgb2hex([250, 0, 10]); // '#fa000a'
$converted->rgb2hex(['red' => 250, 'green' => 0, 'blue' => 10]); // '#fa000a'
$converted->rgb2hex(['r' => 250, 'g' => 0, 'b' => 10]); // '#fa000a'
```

Example
-------

[](#example)

[![map of colors](https://user-images.githubusercontent.com/10347617/43231090-85dfba92-9073-11e8-9dbc-d2968b5ef1a2.png)](https://user-images.githubusercontent.com/10347617/43231090-85dfba92-9073-11e8-9dbc-d2968b5ef1a2.png)

License
-------

[](#license)

This package is licensed under the [MIT License](LICENSE).

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance70

Regular maintenance activity

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~216 days

Recently: every ~306 days

Total

13

Last Release

257d ago

Major Versions

v1.1.0 → v2.0.02020-12-21

2.x-dev → v3.0.02021-12-19

3.x-dev → 4.0.02022-09-04

PHP version history (6 changes)1.0.0PHP &gt;=5.6.4

v1.1.0PHP ^5.6|^7.0|^8.0

v2.0.0PHP ^7.1.3|^8.0

v3.0.0PHP ^7.2.5 || ^8.0

4.0.0PHP ^8.1

4.x-devPHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![andrey-helldar](https://avatars.githubusercontent.com/u/10347617?v=4)](https://github.com/andrey-helldar "andrey-helldar (51 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (39 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (26 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

colortext colordragondragon codeandrey helldarwhich color

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andrey-helldar-which-color/health.svg)

```
[![Health](https://phpackages.com/badges/andrey-helldar-which-color/health.svg)](https://phpackages.com/packages/andrey-helldar-which-color)
```

###  Alternatives

[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[dragon-code/pretty-array

Simple conversion of an array to a pretty view

177.6M4](/packages/dragon-code-pretty-array)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[dragon-code/migrate-db

Easy data transfer from one database to another

15717.4k](/packages/dragon-code-migrate-db)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)

PHPackages © 2026

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