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+

3.0.4(3w ago)01.2kMITPHPPHP &gt;=8.2CI passing

Since Dec 15Pushed 3w 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 2d ago

READMEChangelog (9)Dependencies (13)Versions (13)Used By (0)

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

[](#laravel-color-hash)

[![CI](https://github.com/vongola12324/laravel-color-hash/actions/workflows/ci.yml/badge.svg)](https://github.com/vongola12324/laravel-color-hash/actions/workflows/ci.yml/badge.svg)[![Coverage Status](https://camo.githubusercontent.com/1af6810086fe7eecc3912b4178d2f0e6483b1c67e5717e7f7bb49384ee4b85b2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/vongola12324/laravel-color-hash?branch=master)[![PHP](https://camo.githubusercontent.com/fa9faa8a5384eae9325b23b2827aa0e62ed2a782b52e3ca7da1bcdfcf3478209/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)](https://camo.githubusercontent.com/fa9faa8a5384eae9325b23b2827aa0e62ed2a782b52e3ca7da1bcdfcf3478209/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)[![Version](https://camo.githubusercontent.com/85a44b9c31b582cbe7b98a0286bc23a969ac21277d32c46ec65351837d07ba44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)](https://camo.githubusercontent.com/85a44b9c31b582cbe7b98a0286bc23a969ac21277d32c46ec65351837d07ba44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6e676f6c6131323332342f6c61726176656c2d636f6c6f722d686173682e737667)

ColorHash Library for Laravel 10.0+. Port from [zenozeng/color-hash](https://github.com/zenozeng/color-hash).

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

[](#requirements)

- PHP 8.2+
- Laravel 10.0+

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'); // [233, 0.5, 0.65]

// in RGB, R, G, B ∈ [0, 255]
ColorHash::rgb('Hello World'); // [121, 132, 210]

// in HEX
ColorHash::hex('Hello World'); // '#7984d2'
```

### 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'); // [172, 83, 122]

// Custom Hue
ColorHash::customHue(90)->rgb('Hello World'); // [166, 210, 121]
ColorHash::customHue(['min' => 90, 'max' => 270])->rgb('Hello World'); // [121, 163, 210]
ColorHash::customHue([['min' => 30, 'max' => 90], ['min' => 180, 'max' => 210], ['min' => 270, 'max' => 285]])->rgb('Hello World'); // [121, 185, 210]

// Custom Saturation
ColorHash::customSaturation(0.5)->rgb('Hello World'); // [64, 79, 191]
ColorHash::customSaturation([0.35, 0.5, 0.65])->rgb('Hello World'); // [121, 132, 210]

// Custom Lightness
ColorHash::customLightness(0.5)->rgb('Hello World'); // [64, 79, 191]
ColorHash::customLightness([0.35, 0.5, 0.65])->rgb('Hello World'); // [121, 132, 210]
```

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

54

—

FairBetter than 97% of packages

Maintenance95

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 96.1% 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 ~308 days

Recently: every ~6 days

Total

10

Last Release

23d ago

Major Versions

1.1.0 → 2.0.02020-07-22

2.0.0 → 3.0.02026-06-24

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

2.0.0PHP &gt;7.2

3.0.0PHP &gt;=8.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 (49 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laravelcolorhash

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### 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

[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[emargareten/inertia-modal

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

90157.6k](/packages/emargareten-inertia-modal)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.8k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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