spatie/color
A little library to handle color conversions
2.1.0
23M downloads/mo
#747 most downloaded on Packagist
spatie/color
What this package is like to depend on
Last release 6 months ago
08 Feb 2026
Ships unpredictably
gaps range from 8 days to 1.8 years
Most releases are documented
notes for 20 of 23 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
23 releases · first in 2016
2 releases in the last 12 months
see the full history below
Release timeline
23 releases · Sep 2016 to Feb 2026Releases
latest 23-
2.1.008 Feb 2026Release notes
Open source →What's Changed
- ADD argb support by @enricodelazzari in #100
New Contributors
- @enricodelazzari made their first contribution in #100
Full Changelog: v2.0.0...2.1.0
Release notes
Open source →What's Changed
- ADD argb support by @enricodelazzari in https://github.com/spatie/color/pull/100
New Contributors
- @enricodelazzari made their first contribution in https://github.com/spatie/color/pull/100
Full Changelog: https://github.com/spatie/color/compare/v2.0.0...2.1.0
-
v2.0.031 Jan 2026Release notes
Open source →What's Changed
Breaking Changes
- Require PHP 8.2 or higher (dropped support for PHP 7.x, 8.0, 8.1)
- Removed
Hsla::contrast()method (was broken) - Added return type hints to
Colorinterface - custom implementations must add:fromString(): staticred(): int|stringgreen(): int|stringblue(): int|string
Improvements
- Modernized codebase with constructor property promotion
- Upgraded to Pest 4 and PHPUnit 11
- Tests now run on PHP 8.2, 8.3, 8.4, and 8.5
- Cleaned up README badges
Full Changelog: 1.5.3...v2.0.0
Release notes
Open source →What's Changed
Breaking Changes
- Require PHP 8.2 or higher (dropped support for PHP 7.x, 8.0, 8.1)
- Removed
Hsla::contrast()method (was broken) - Added return type hints to
Colorinterface - custom implementations must add:fromString(): staticred(): int|stringgreen(): int|stringblue(): int|string
Improvements
- Modernized codebase with constructor property promotion
- Upgraded to Pest 4 and PHPUnit 11
- Tests now run on PHP 8.2, 8.3, 8.4, and 8.5
- Cleaned up README badges
Full Changelog: https://github.com/spatie/color/compare/1.5.3...v2.0.0
-
1.8.010 Feb 2025Release notes
Open source →What's Changed
- Enable alpha color conversion between Hex, Hsla, and Rgba formats by @thaqebon in https://github.com/spatie/color/pull/94
New Contributors
- @thaqebon made their first contribution in https://github.com/spatie/color/pull/94
Full Changelog: https://github.com/spatie/color/compare/1.7.0...1.8.0
-
1.7.030 Dec 2024Release notes
Open source →What's Changed
- Extended HSL/HSLA/HSB Handling with Float Support by @danielebarbaro in #93
Full Changelog: 1.6.3...1.7.0
Release notes
Open source →What's Changed
- Extended HSL/HSLA/HSB Handling with Float Support by @danielebarbaro in https://github.com/spatie/color/pull/93
Full Changelog: https://github.com/spatie/color/compare/1.6.3...1.7.0
-
1.6.323 Dec 2024Release notes
Open source →What's Changed
- Test Enhancements for Contrast Calculations (and mini refactor for contrast class) by @danielebarbaro in #92
New Contributors
- @danielebarbaro made their first contribution in #92
Full Changelog: 1.6.2...1.6.3
Release notes
Open source →What's Changed
- Test Enhancements for Contrast Calculations (and mini refactor for contrast class) by @danielebarbaro in https://github.com/spatie/color/pull/92
New Contributors
- @danielebarbaro made their first contribution in https://github.com/spatie/color/pull/92
Full Changelog: https://github.com/spatie/color/compare/1.6.2...1.6.3
-
1.6.209 Dec 2024Release notes
Open source →What's Changed
- Issue #88 Cast return to float instead of string to match Contrast ratio return type by @NiklasBr in #91
New Contributors
Full Changelog: 1.6.1...1.6.2
Release notes
Open source →What's Changed
- Issue #88 Cast return to float instead of string to match Contrast ratio return type by @NiklasBr in https://github.com/spatie/color/pull/91
New Contributors
- @NiklasBr made their first contribution in https://github.com/spatie/color/pull/91
Full Changelog: https://github.com/spatie/color/compare/1.6.1...1.6.2
-
1.6.118 Nov 2024Release notes
Open source →What's Changed
- Fix wrong Validation Error message for hsla strings by @Afrowson in https://github.com/spatie/color/pull/90
New Contributors
- @Afrowson made their first contribution in https://github.com/spatie/color/pull/90
Full Changelog: https://github.com/spatie/color/compare/1.6.0...1.6.1
-
1.6.020 Sep 2024Release notes
Open source →What's Changed
- Ignore more file when packaging releases by @andypost in #83
- Fix typo in README for Hsl::fromString() in Cast the color to a string. by @agnonym in #84
- Added named colors by @vanodevium in #87
New Contributors
- @andypost made their first contribution in #83
- @agnonym made their first contribution in #84
- @vanodevium made their first contribution in #87
Full Changelog: 1.5.3...1.6.0
Release notes
Open source →What's Changed
- Ignore more file when packaging releases by @andypost in https://github.com/spatie/color/pull/83
- Fix typo in README for Hsl::fromString() in Cast the color to a string. by @agnonym in https://github.com/spatie/color/pull/84
- Added named colors by @vanodevium in https://github.com/spatie/color/pull/87
New Contributors
- @andypost made their first contribution in https://github.com/spatie/color/pull/83
- @agnonym made their first contribution in https://github.com/spatie/color/pull/84
- @vanodevium made their first contribution in https://github.com/spatie/color/pull/87
Full Changelog: https://github.com/spatie/color/compare/1.5.3...1.6.0
-
1.5.318 Dec 2022Release notes
Open source →What's Changed
- Refactor tests to pest by @AyoobMH in #80
- Add PHP 8.2 Support by @patinthehat in #81
- Fix rgb to cmyk division by zero bug by @stefanriehl in #82
New Contributors
- @AyoobMH made their first contribution in #80
- @patinthehat made their first contribution in #81
- @stefanriehl made their first contribution in #82
Full Changelog: 1.5.2...1.5.3
Release notes
Open source →What's Changed
- Refactor tests to pest by @AyoobMH in https://github.com/spatie/color/pull/80
- Add PHP 8.2 Support by @patinthehat in https://github.com/spatie/color/pull/81
- Fix rgb to cmyk division by zero bug by @stefanriehl in https://github.com/spatie/color/pull/82
New Contributors
- @AyoobMH made their first contribution in https://github.com/spatie/color/pull/80
- @patinthehat made their first contribution in https://github.com/spatie/color/pull/81
- @stefanriehl made their first contribution in https://github.com/spatie/color/pull/82
Full Changelog: https://github.com/spatie/color/compare/1.5.2...1.5.3
-
1.5.224 Jun 2022Release notes
Open source →What's Changed
- Add RegEx fix to Validate.php too... by @jcogs-design in #73
- Fix typo in Distance::CIE76. by @Angel5a in #76
New Contributors
- @jcogs-design made their first contribution in #73
- @Angel5a made their first contribution in #76
Full Changelog: 1.5.1...1.5.2
Release notes
Open source →What's Changed
- Add RegEx fix to Validate.php too... by @jcogs-design in https://github.com/spatie/color/pull/73
- Fix typo in Distance::CIE76. by @Angel5a in https://github.com/spatie/color/pull/76
New Contributors
- @jcogs-design made their first contribution in https://github.com/spatie/color/pull/73
- @Angel5a made their first contribution in https://github.com/spatie/color/pull/76
Full Changelog: https://github.com/spatie/color/compare/1.5.1...1.5.2
-
1.5.112 Apr 2022Nothing published for this version
-
1.5.011 Jan 2022Nothing published for this version
-
v1.3.006 Sep 2021 -
1.2.418 Feb 2021 -
1.2.218 Nov 2020 -
1.2.117 Jul 2020 -
1.2.022 Jun 2020 -
1.1.103 Feb 2017Release notes
Open source →- Fixed validation when a color contained redundant characters at the beginning or end of the string
-
1.1.026 Jan 2017Release notes
Open source →- All color formats now implement a
Colorinterface - Added a
Factoryclass with afromStringstatic method to guess a format rgbandrgbavalues can now contain spaces (e.g.rgb(255, 255, 255))
- All color formats now implement a
-
1.0.217 Oct 2016 -
1.0.122 Sep 2016Release notes
Open source →- Bugfix (breaking!): Alpha channel values are now a float between 0 and 1
-
1.0.020 Sep 2016 -
0.1.020 Sep 2016Nothing published for this version