PHPackages                             soapbox/css-colors - 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. soapbox/css-colors

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

soapbox/css-colors
==================

A package that takes in a color hex and returns potential foreground colours and background colour variations. Very useful for creating CSS gradients and dynamically figuring out foreground colour.

1.0(11y ago)915.2k6MITPHPPHP &gt;=5.3.0

Since Jul 17Pushed 8y ago16 watchersCompare

[ Source](https://github.com/Soapbox/css-colors)[ Packagist](https://packagist.org/packages/soapbox/css-colors)[ Docs](https://github.com/SoapBox/css-colors)[ RSS](/packages/soapbox-css-colors/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (3)Versions (2)Used By (0)

css-colors
==========

[](#css-colors)

[![Build Status](https://camo.githubusercontent.com/27fbc41c59a87277f8f0f087b69e9d1cff078efe9185266970c6a8bbbc370415/68747470733a2f2f7472617669732d63692e6f72672f536f6170426f782f6373732d636f6c6f72732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/SoapBox/css-colors)

Takes in a HEX color and produces variations of that colour for the foreground and background

It takes a great php class made by Patrick Fitzgerald in 2004 (  ) and wraps it in a library for use in your project.

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

[](#installation)

Install this package through Composer. Add the following to your composer.json file:

```
"require": {
    "soapbox/css-colors": "dev-master"
}
```

Next, run composer install

Finally, add the service provider and the facade to app/config/app.php.

```
'providers' => array(
    // ...

    'SoapBox\Csscolor\CsscolorServiceProvider'
)

Not required, but you can addd the Csscolor alias if you want.

'aliases' => array(
    // ...

    'Csscolor' => 'SoapBox\Csscolor\Facade'
)
```

How to Use:
-----------

[](#how-to-use)

All you need to do is put the HEX values into a colour object

```
$color = Csscolor::make('3D88C8');

$color->bg['0']; // returns the same colour as entered
$color->bg['+1']; // +1 to +5 and -1 to -5 to return variations of the colour to work with gradiants
$color->fg['0']; // returns a colour that can sit on the foreground of the defined hex value
...
```

A var\_dump of the $color objects instanciated with the color #3D88C8 look like the following:

```
object(SoapBox\Csscolor\Csscolor)[1109]
  public 'bg' =>
    array (size=11)
      0 => string '3D88C8' (length=6)
      '+1' => string '5a9ad0' (length=6)
      '+2' => string '6ea6d6' (length=6)
      '+3' => string '9fc4e4' (length=6)
      '+4' => string 'cee1f1' (length=6)
      '+5' => string 'ecf4fa' (length=6)
      -1 => string '3474aa' (length=6)
      -2 => string '2e6696' (length=6)
      -3 => string '1f4464' (length=6)
      -4 => string '0f2232' (length=6)
      -5 => string '060e14' (length=6)
  public 'fg' =>
    array (size=11)
      0 => string 'ffffff' (length=6)
      '+1' => string '000000' (length=6)
      '+2' => string '000000' (length=6)
      '+3' => string '000000' (length=6)
      '+4' => string '0f2232' (length=6)
      '+5' => string '1f4464' (length=6)
      -1 => string 'ffffff' (length=6)
      -2 => string 'ffffff' (length=6)
      -3 => string 'ffffff' (length=6)
      -4 => string 'cee1f1' (length=6)
      -5 => string '9fc4e4' (length=6)
  public 'minBrightDiff' => int 126
  public 'minColorDiff' => int 500
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% 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

Unknown

Total

1

Last Release

4319d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1336930?v=4)[Graham McCarthy](/maintainers/grahammccarthy)[@grahammccarthy](https://github.com/grahammccarthy)

---

Top Contributors

[![grahammccarthy](https://avatars.githubusercontent.com/u/1336930?v=4)](https://github.com/grahammccarthy "grahammccarthy (13 commits)")[![bendalton](https://avatars.githubusercontent.com/u/34530?v=4)](https://github.com/bendalton "bendalton (1 commits)")[![jamesfairhurst](https://avatars.githubusercontent.com/u/230768?v=4)](https://github.com/jamesfairhurst "jamesfairhurst (1 commits)")[![Jaspaul](https://avatars.githubusercontent.com/u/2836589?v=4)](https://github.com/Jaspaul "Jaspaul (1 commits)")

---

Tags

cssmanipulationcolorhexbackgroundgradientshadingforeground

### Embed Badge

![Health badge](/badges/soapbox-css-colors/health.svg)

```
[![Health](https://phpackages.com/badges/soapbox-css-colors/health.svg)](https://phpackages.com/packages/soapbox-css-colors)
```

###  Alternatives

[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)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[syholloway/mrcolor

Color manipulation tools and format conversion for PHP

14149.6k](/packages/syholloway-mrcolor)[krisawzm/critical-css

A Laravel package for generating and using inline critical-path CSS.

4714.2k2](/packages/krisawzm-critical-css)

PHPackages © 2026

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