PHPackages                             binafy/php-color-generator - 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. binafy/php-color-generator

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

binafy/php-color-generator
==========================

Generate colors with PHP

v1.0.0(1y ago)94MITPHPPHP ^7.3|^8.0CI passing

Since Jan 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/binafy/php-color-generator)[ Packagist](https://packagist.org/packages/binafy/php-color-generator)[ Docs](https://github.com/binafy/php-color-generator)[ RSS](/packages/binafy-php-color-generator/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

PHP Color Generator
===================

[](#php-color-generator)

[![php-color-generator](https://camo.githubusercontent.com/014826abab8499f9aaeb1991562e50d0d5b78f493459eaf4e7177a179d1f3211/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f504850253230436f6c6f7225323047656e657261746f722e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d62696e6166792532467068702d636f6c6f722d67656e657261746f72267061747465726e3d63616765267374796c653d7374796c655f31266465736372697074696f6e3d47656e65726174652b636f6c6f72732b776974682b504850266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)](https://camo.githubusercontent.com/014826abab8499f9aaeb1991562e50d0d5b78f493459eaf4e7177a179d1f3211/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f504850253230436f6c6f7225323047656e657261746f722e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d62696e6166792532467068702d636f6c6f722d67656e657261746f72267061747465726e3d63616765267374796c653d7374796c655f31266465736372697074696f6e3d47656e65726174652b636f6c6f72732b776974682b504850266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)

[![PHP Version Require](https://camo.githubusercontent.com/e4c6c8795f13bf36d7f73016374102fad33fd5e8d949b4f6ee1d310280d544c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f62696e6166792f7068702d636f6c6f722d67656e657261746f722f706870)](https://packagist.org/packages/binafy/php-color-generator)[![Latest Stable Version](https://camo.githubusercontent.com/67012c7435c68ae217416784539d36c66fb48b99c4af31cd382ea3caa3e72caf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62696e6166792f7068702d636f6c6f722d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/binafy/php-color-generator)[![Total Downloads](https://camo.githubusercontent.com/0da3b7bf2b36b05d758376a6de12466d5e66b8c8df20549d0be410d85942072c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62696e6166792f7068702d636f6c6f722d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/binafy/php-color-generator)[![License](https://camo.githubusercontent.com/158c292053fbd9cad3a2b4d1eb10c705fafc02dcf4bd9094909f9194fd93dddf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f62696e6166792f7068702d636f6c6f722d67656e657261746f72)](https://packagist.org/packages/binafy/php-color-generator)[![Passed Tests](https://github.com/binafy/php-color-generator/actions/workflows/tests.yml/badge.svg)](https://github.com/binafy/php-color-generator/actions/workflows/tests.yml)

Introduction
------------

[](#introduction)

The `PHP Color Generator` is a versatile PHP package designed for easy and efficient color manipulation. Whether you're working with color schemes, themes, or UI designs, this package provides a set of utilities to convert, darken, lighten, and generate shades or tints of colors. It supports the conversion of hex to RGB and vice versa, allows for adjusting the lightness or darkness of colors, and can generate a series of tints or shades based on a base color. Ideal for designers and developers who need to programmatically handle color variations for dynamic interfaces or applications.

Requirements
------------

[](#requirements)

---

- `PHP >= 7.3`

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

[](#installation)

You can install the package with Composer.

```
composer require binafy/php-color-generator
```

Usage
-----

[](#usage)

#### `hexToRGB(string $hex): array`

[](#hextorgbstring-hex-array)

If you may convert hex to RGB, you need to use `hexToRGB()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::hexToRGB('1363df');
```

#### `rgbToHex(string $hex): string`

[](#rgbtohexstring-hex-string)

If you may convert RGB to hex, you need to use `rgbToHex()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::rgbToHex([
    'red' => '19',
    'green' => '99',
    'blue' => '223',
]);
```

#### `darken(array $rgb, float $percentage): array`

[](#darkenarray-rgb-float-percentage-array)

If you may get darken rgb color, you can use `darken()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::darken([
    'red' => '19',
    'green' => '99',
    'blue' => '223',
], 0.5); // array ('red', 'blue', 'green')
```

#### `lighten(array $rgb, float $percentage): array`

[](#lightenarray-rgb-float-percentage-array)

If you may get lighten rgb color, you can use `lighten()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::lighten([
    'red' => '19',
    'green' => '99',
    'blue' => '223',
], 0.5); // array ('red', 'blue', 'green')
```

#### `generateShades(string $hex, int $times): array`

[](#generateshadesstring-hex-int-times-array)

If you want to generate shades from hex color, you can use `generateShades()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::generateShades('1363df', 10);
```

#### `generateTints(string $hex, int $times): array`

[](#generatetintsstring-hex-int-times-array)

If you want to generate tints from hex color, you can use `generateTints()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::generateTints('1363df', 10);
```

#### `generateDarkBrightColors(string $hex, int $times = 10): array`

[](#generatedarkbrightcolorsstring-hex-int-times--10-array)

If you want to generate tints, shades from hex color, you can use `generateDarkBrightColors()` method:

```
use Binafy\PhpColorGenerator\Color;

Color::generateDarkBrightColors('1363df', 10); // array ('dark', 'light')
```

Security
--------

[](#security)

If you discover any security-related issues, please email `binafy23@gmail.com` instead of using the issue tracker.

Changelog
---------

[](#changelog)

The changelog can be found in the `CHANGELOG.md` file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each version of the Laravel User Monitoring package.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/binafy/php-color-generator/blob/1.x/LICENSE) for more information.

Star History
------------

[](#star-history)

[![Star History Chart](https://camo.githubusercontent.com/297eafd7e8b2efbbdb3857d4423e5012b96ecf3bc9d3483d1e0527fc93b9a157/68747470733a2f2f6170692e737461722d686973746f72792e636f6d2f7376673f7265706f733d62696e6166792f7068702d636f6c6f722d67656e657261746f7226747970653d44617465)](https://star-history.com/#binafy/php-color-generator&Date)

Conclusion
----------

[](#conclusion)

Congratulations! You have successfully installed and integrated the Laravel User Monitoring package into your Laravel application. By effectively logging and analyzing user activity, you can gain valuable insights that can help you improve your application's user experience and performance. If you have any questions or need further assistance, please refer to the documentation or seek help from the package's GitHub repository. Happy monitoring!

Donate
------

[](#donate)

If this package is helpful for you, you can buy a coffee for me :) ❤️

- Iranian Gateway: [https://daramet.com/milwad\_khosravi](https://daramet.com/milwad_khosravi)
- Paypal Gateway: SOON
- MetaMask Address: `0xf208a562c5a93DEf8450b656c3dbc1d0a53BDE58`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance44

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Every ~0 days

Total

2

Last Release

465d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56315159ed0aaddaed135c51aa64d56800b7be05ead525b35a0057d18b44b40e?d=identicon)[binafy](/maintainers/binafy)

---

Top Contributors

[![milwad-dev](https://avatars.githubusercontent.com/u/98118400?v=4)](https://github.com/milwad-dev "milwad-dev (45 commits)")

---

Tags

binafycolor-generatorhexhex-to-rgblibrarymilwadphpphp-colorphp-color-generatorphp-generator-colorrgbshadetintphplibraryrgbhexmilwadbinafycolor-generatorphp-colorphp-color-generatorphp-generator-colorhex-to-rgb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/binafy-php-color-generator/health.svg)

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

PHPackages © 2026

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