PHPackages                             owen-jones/color-kit - 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. owen-jones/color-kit

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

owen-jones/color-kit
====================

A PHP library for manipulating accessible color combinations.

1.0.1(1y ago)0191MITPHPPHP &gt;=8.1

Since Jun 4Pushed 1y agoCompare

[ Source](https://github.com/owen-jones/color-kit)[ Packagist](https://packagist.org/packages/owen-jones/color-kit)[ RSS](/packages/owen-jones-color-kit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

ColorKit
========

[](#colorkit)

ColorKit is a PHP library for handling and manipulating colors. It provides utilities for generating color triads and checking color contrast accessibility.

---

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

[](#installation)

To install ColorKit, run:

```
composer require owen-jones/color-kit
```

---

Usage
-----

[](#usage)

### Generating Color Triads

[](#generating-color-triads)

To get a color triad based on a base color:

```
require 'vendor/autoload.php';

use OwenJones\ColorKit\ColorKit;

$baseColor = '#3498db';
$triad = ColorKit::getColorTriad($baseColor);

print_r($triad);
// ['#3498db', '#db3434', '#34db34']
```

The first 2 colors are guaranteed to be accessible. The third is not.

### Checking Color Contrast

[](#checking-color-contrast)

To check if the contrast between two colors is accessible (contrast ratio of at least 4.5):

```
use OwenJones\ColorKit\ColorKit;

$color1 = '#3498db';
$color2 = '#ffffff';

$isAccessible = ColorKit::isContrastAccessible($color1, $color2);

echo $isAccessible ? 'Accessible' : 'Not Accessible';
```

---

Methods
-------

[](#methods)

`getColorTriad(string $baseColor): array`

Generates a color triad based on the base color.

- Parameters:
    - `string $baseColor`: Hex value of the base color.
- Returns:
    - `string[]`: An array containing the base color and two other colors.

`isContrastAccessible(string $color1, string $color2): bool`

Checks if the contrast between two colors is accessible.

- Parameters:
    - `string $color1`: Hex value of the first color.
    - `string $color2`: Hex value of the second color.
- Returns:
    - `bool`: `true` if the contrast ratio is at least 4.5, `false` otherwise.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

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

Total

2

Last Release

699d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/500f0e4e340af05926d9a5c1dff4fb2fe685698fb5ca3c7a1c6a54c51ce0a171?d=identicon)[owendev](/maintainers/owendev)

---

Top Contributors

[![allanpichardo](https://avatars.githubusercontent.com/u/5606153?v=4)](https://github.com/allanpichardo "allanpichardo (8 commits)")[![braican](https://avatars.githubusercontent.com/u/3286676?v=4)](https://github.com/braican "braican (1 commits)")

---

Tags

coloraccessibilitycontrast

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/owen-jones-color-kit/health.svg)

```
[![Health](https://phpackages.com/badges/owen-jones-color-kit/health.svg)](https://phpackages.com/packages/owen-jones-color-kit)
```

###  Alternatives

[spatie/color

A little library to handle color conversions

38018.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)
