PHPackages                             vongola12324/laravel-color-hash - 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. vongola12324/laravel-color-hash

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

vongola12324/laravel-color-hash
===============================

ColorHash Library for Laravel 5.0+

2.0.0(5y ago)01.1kMITPHPPHP &gt;7.2CI failing

Since Dec 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/vongola12324/laravel-color-hash)[ Packagist](https://packagist.org/packages/vongola12324/laravel-color-hash)[ Docs](https://github.com/vongola12324/laravel-color-hash)[ RSS](/packages/vongola12324-laravel-color-hash/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

laravel-color-hash
==================

[](#laravel-color-hash)

[![](https://camo.githubusercontent.com/1ff27a703a93d719bb56a4f5bdb8df278b727bd3c8317c7fb9ffeea0d8407d65/68747470733a2f2f7472617669732d63692e6f72672f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/1ff27a703a93d719bb56a4f5bdb8df278b727bd3c8317c7fb9ffeea0d8407d65/68747470733a2f2f7472617669732d63692e6f72672f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e7376673f6272616e63683d6d6173746572) [![](https://camo.githubusercontent.com/69f7d42db0a5775dd691909f3fe084b37bf4e7b7d4181f8bc3aa616dfb07962c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)](https://camo.githubusercontent.com/69f7d42db0a5775dd691909f3fe084b37bf4e7b7d4181f8bc3aa616dfb07962c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667) [![](https://camo.githubusercontent.com/fa9faa8a5384eae9325b23b2827aa0e62ed2a782b52e3ca7da1bcdfcf3478209/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)](https://camo.githubusercontent.com/fa9faa8a5384eae9325b23b2827aa0e62ed2a782b52e3ca7da1bcdfcf3478209/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667) [![](https://camo.githubusercontent.com/85a44b9c31b582cbe7b98a0286bc23a969ac21277d32c46ec65351837d07ba44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)](https://camo.githubusercontent.com/85a44b9c31b582cbe7b98a0286bc23a969ac21277d32c46ec65351837d07ba44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)
ColorHash Library for Laravel 5.0+. Port from [zenozeng/color-hash](https://github.com/zenozeng/color-hash).

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

[](#installation)

```
composer require vongola12324/laravel-color-hash
```

Usage
-----

[](#usage)

### Basic

[](#basic)

```
// in HSL, Hue ∈ [0, 360), Saturation ∈ [0, 1], Lightness ∈ [0, 1]
ColorHash::hsl('Hello World'); // [185, 0.35, 0.35]

// in RGB, R, G, B ∈ [0, 255]
ColorHash::rgb('Hello World'); // [58, 115, 120]

// in HEX
ColorHash::hex('Hello World'); // '#3a7378'
```

### Custom

[](#custom)

```
// Custom Hash Function
$hashFunc = function ($string) {
    $hash = 0;
    for ($i = 0; $i < strlen($string); $i++) {
        $hash += ord($string[$i]);
    }
    return $hash;
}
ColorHash::customHash($hashFunc)->rgb('Hello World'); // [31, 147, 109]

// Custom Hue
ColorHash::customHue(90)->rgb('Hello World'); // [89, 120, 58]
ColorHash::customHue(['min' => 90, 'max' => 270])->rgb('Hello World'); // [58, 118, 120]
ColorHash::customHue([['min' => 30, 'max' => 90], ['min' => 180, 'max' => 210], ['min' => 270, 'max' => 285]])->rgb('Hello World'); // [120, 100, 58]

// Custom Saturation
ColorHash::customSaturation(0.5)->rgb('Hello World'); // [45, 126, 134]
ColorHash::customSaturation([0.35, 0.5, 0.65])->rgb('Hello World'); // [58, 115, 120]

// Custom Lightness
ColorHash::customLightness(0.5)->rgb('Hello World'); // [83, 165, 172]
ColorHash::customLightness([0.35, 0.5, 0.65])->rgb('Hello World'); // [58, 115, 120]
```

All customXXX method can be used in a single custom method by passing an option array, for example:

```
ColorHash::customHue(90)->rgb('Test');
// Is Equal to
ColorHash::custom(['hue' => 90])->rgb('Test');
```

Also can combine with more than one custom option, for example:

```
ColorHash::customHue(90)->customSaturation(0.5)->customLightness(0.5)->customHash($hashFunc)->rgb('Test');
// Is Equal to
ColorHash::custom(['hue' => 90, 'saturation' => 0.5, 'lightness' => 0.5, 'hash' => $hashFunc])->rgb('Test');
```

License
-------

[](#license)

MIT.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~146 days

Total

5

Last Release

2166d ago

Major Versions

1.1.0 → 2.0.02020-07-22

PHP version history (2 changes)1.1.0PHP &gt;7.0

2.0.0PHP &gt;7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5770715?v=4)[Vongola](/maintainers/vongola12324)[@vongola12324](https://github.com/vongola12324)

---

Top Contributors

[![vongola12324](https://avatars.githubusercontent.com/u/5770715?v=4)](https://github.com/vongola12324 "vongola12324 (44 commits)")

---

Tags

laravelcolorhash

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/vongola12324-laravel-color-hash/health.svg)

```
[![Health](https://phpackages.com/badges/vongola12324-laravel-color-hash/health.svg)](https://phpackages.com/packages/vongola12324-laravel-color-hash)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k9.6k1](/packages/vinkius-labs-laravel-page-speed)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90128.1k](/packages/emargareten-inertia-modal)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

3614.9k](/packages/linkxtr-laravel-qrcode)[wearepixel/laravel-cart

A cart implementation for Laravel

1355.6k](/packages/wearepixel-laravel-cart)

PHPackages © 2026

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