PHPackages                             phlak/colorizer - 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. phlak/colorizer

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

phlak/colorizer
===============

Generate persistantly unique colors from a string.

5.0.0(1y ago)1422.6k↓64.7%5[1 PRs](https://github.com/PHLAK/Colorizer/pulls)MITPHPPHP ^8.2 || ^8.3 || ^8.4CI passing

Since Apr 8Pushed 1y ago3 watchersCompare

[ Source](https://github.com/PHLAK/Colorizer)[ Packagist](https://packagist.org/packages/phlak/colorizer)[ RSS](/packages/phlak-colorizer/feed)WikiDiscussions master Synced 2d ago

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

Colorizer
=========

[](#colorizer)

 [![Colorizer](colorizer.png)](colorizer.png)

 [![Join our Community](https://camo.githubusercontent.com/073a08ec4c3c801a8e24c53184d95a6562d74582854cb46320bcd76ef48ea543/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a6f696e5f7468652d436f6d6d756e6974792d3762313666662e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/PHLAK/Colorizer/discussions) [![Become a Sponsor](https://camo.githubusercontent.com/00da07edf5fbff7528a4743d85563603f9284f02680e0ab1e73652e680878548/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4265636f6d655f612d53706f6e736f722d6363343139352e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/users/PHLAK/sponsorship) [![One-time Donation](https://camo.githubusercontent.com/e9b5aa71ffdb17943c10c6d6b4a3132b66a938495331e488ecbdad1f3c078879/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d616b655f612d446f6e6174696f6e2d3030366262362e7376673f7374796c653d666f722d7468652d6261646765)](https://paypal.me/ChrisKankiewicz)
 [![Latest Stable Version](https://camo.githubusercontent.com/5ec7511f4e8b93f59e4bbe5261d8dab5031db6f50a7704870af327a890210eba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f50484c414b2f436f6c6f72697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/PHLAK/Colorizer) [![Total Downloads](https://camo.githubusercontent.com/db67c0b34a6b7594f38379febcf6bc4401122616eff3b909b7f4a45e2511431e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f50484c414b2f436f6c6f72697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/PHLAK/Colorizer) [![License](https://camo.githubusercontent.com/b632dd613469acb5aba67cb60c71a754c8ca5a39c0f41100964b562a02c342c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f50484c414b2f436f6c6f72697a65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/PHLAK/Colorizer/blob/master/LICENSE) [![Build Status](https://camo.githubusercontent.com/d4f39dd437e3dffe797f21590a8e61de27bd213861d4ac063819136cdc935e4d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f50484c414b2f436f6c6f72697a65722f746573742d73756974652e79616d6c3f7374796c653d666c61742d737175617265)](https://github.com/PHLAK/Colorizer/actions)

 Generate persistently unique colors from a string.
 Created by [Chris Kankiewicz](https://www.ChrisKankiewicz.com) ([@PHLAK](https://twitter.com/PHLAK))

---

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

[](#requirements)

- [PHP](https://php.net) &gt;= 8.1

Install with Composer
---------------------

[](#install-with-composer)

```
composer require phlak/colorizer
```

Usage
-----

[](#usage)

```
// Import Colorizer
use PHLAK\Colorizer;

// Initialize Colorizer
$colorize = new Colorizer\Colorize();

// Generate a Color object from 'foo'
$color = $colorize->text('foo'); // Returns a new Color object

// Get the red, green and blue values
$color->red;    // 165
$color->green;  // 196
$color->blue;   // 254

// Generate a hex color code
$color->hex();  // Returns '#a5c4fe'

// Generate a RGB color code
$color->rgb();  // Returns 'rgb(165, 196, 254)'
```

#### Normalizing Colors

[](#normalizing-colors)

You can enforce RGB values to fall within a certain range to prevent colors from being too bright or dark. This is possible by passing minimum and maximum normalization values (0-255) to the Colorize class on initialization:

```
$colorize = new Colorizer\Colorize(64, 224);
```

or fluently:

```
$colorize->text('foo')->normalize(64, 224)->rgb();  // Returns 'rgb(165, 196, 224)'
```

Changelog
---------

[](#changelog)

A list of changes can be found on the [GitHub Releases](https://github.com/PHLAK/Colorizer/releases) page.

Troubleshooting
---------------

[](#troubleshooting)

For general help and support join our [GitHub Discussion](https://github.com/PHLAK/Colorizer/discussions)or reach out on [Bluesky](https://bsky.app/profile/phlak.dev).

Please report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/Colorizer/issues).

Copyright
---------

[](#copyright)

This project is licensed under the [MIT License](https://github.com/PHLAK/Colorizer/blob/master/LICENSE).

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.6% 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 ~243 days

Recently: every ~690 days

Total

17

Last Release

574d ago

Major Versions

0.2.0 → 1.0.02014-04-08

1.4.1 → 2.0.02016-10-09

2.0.0 → 3.0.02017-05-17

3.0.2 → 4.0.02017-09-06

4.0.0 → 5.0.02024-12-06

PHP version history (3 changes)0.1.1PHP &gt;=5.3.0

3.0.0PHP &gt;=5.6

5.0.0PHP ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53531?v=4)[Chris Kankiewicz](/maintainers/PHLAK)[@PHLAK](https://github.com/PHLAK)

---

Top Contributors

[![PHLAK](https://avatars.githubusercontent.com/u/53531?v=4)](https://github.com/PHLAK "PHLAK (109 commits)")[![eliashaeussler](https://avatars.githubusercontent.com/u/16313625?v=4)](https://github.com/eliashaeussler "eliashaeussler (2 commits)")[![alfredbez](https://avatars.githubusercontent.com/u/1001186?v=4)](https://github.com/alfredbez "alfredbez (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![sprain](https://avatars.githubusercontent.com/u/260361?v=4)](https://github.com/sprain "sprain (1 commits)")

---

Tags

colorpersistent-colorsphpcolorcolorizecolor hash

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phlak-colorizer/health.svg)

```
[![Health](https://phpackages.com/badges/phlak-colorizer/health.svg)](https://phpackages.com/packages/phlak-colorizer)
```

###  Alternatives

[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5275.9M121](/packages/symplify-monorepo-builder)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)[phpdocumentor/reflection

Reflection library to do Static Analysis for PHP Projects

12525.9M148](/packages/phpdocumentor-reflection)[sylius/promotion

Flexible promotion management for PHP applications.

28505.6k15](/packages/sylius-promotion)[sylius/money-bundle

Currencies and money formatting engine bundle for Symfony.

19681.3k26](/packages/sylius-money-bundle)[sylius/product

Product catalog system with support for product options and variants.

24394.2k22](/packages/sylius-product)

PHPackages © 2026

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