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)1420.4k↓48.5%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 1mo 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

50

—

FairBetter than 96% of packages

Maintenance40

Moderate activity, may be stable

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

528d 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

[spatie/color

A little library to handle color conversions

38118.9M28](/packages/spatie-color)[mexitek/phpcolors

A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.

5003.6M18](/packages/mexitek-phpcolors)[mistic100/randomcolor

Generate attractive random colors

2431.4M6](/packages/mistic100-randomcolor)[kartik-v/yii2-widget-colorinput

An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)

324.8M10](/packages/kartik-v-yii2-widget-colorinput)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[tecnickcom/tc-lib-color

PHP library to manipulate various color representations

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

PHPackages © 2026

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