Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Color Laravel Package

primal/color

primal/color is a PHP package for working with colors in Laravel and other PHP apps, offering helpers to convert between formats like hex, RGB, and HSL, adjust shades and brightness, and generate or manipulate palettes with a simple, expressive API.

View on GitHub
Deep Wiki
Context7

Collection of classes for converting and manipulating colors

Frequently asked questions about Color
How do I install primal/color in a Laravel application?
Install it with composer require primal/color. Because it is a plain PHP utility library, there is no Laravel service provider, facade, or config file to publish; you reference the classes from your own service or helper. A common approach is to bind an application-owned ColorConverter interface to an adapter that delegates to the package.
Does primal/color work with Laravel 10 and Laravel 11?
The package is framework-agnostic, so Laravel version support depends mostly on the PHP version your Laravel release requires. Release 1.0.2 fixed a PHP 8.2 deprecation warning, which suggests compatibility with current PHP runtimes, but validate the full matrix of PHP 8.2, 8.3, 8.4, and your Laravel version through Composer constraints and a quick smoke test before adopting. There is no official Laravel integration to be version-specific about.
Is there a Laravel service provider or facade for primal/color?
No. primal/color has no Laravel service provider, facade, or configuration file, which is normal for a small utility library. Use it directly or, better, wrap it behind an application-owned interface so the package stays an implementation detail.
What color formats does primal/color support?
It parses common color string formats and converts between hex, RGB, and HSL. Manipulation helpers cover lightening, darkening, and adjusting colors through a fluent, chainable API. Alpha channels, out-of-gamut values, and rounding behavior are not clearly documented, so test those cases against your requirements.
How do I lighten or darken a color with primal/color?
Use the manipulation helpers on a color instance and chain calls thanks to the fluent API. For example, parse a hex color, call the lighten or darken helper with an amount, then convert the result back to hex or RGB. Encapsulate these chains in your own palette service so call sites do not depend on package-specific objects.
Can I use primal/color in queued jobs and Artisan commands?
Yes. The library is stateless and has no framework or runtime coupling, so it is safe to use inside queued jobs, Artisan commands, and HTTP requests. Inject it through your adapter rather than resolving it ad hoc, and keep package-specific color objects from crossing job payload boundaries.
What is the license for primal/color, and is it safe for commercial use?
The repository is currently marked NOASSERTION, meaning GitHub cannot detect a recognized license. That requires legal review before commercial or production use, and you should treat it as a blocker until clarified. If licensing is not resolved, an internal helper or a clearly licensed alternative is the safer path.
Is primal/color actively maintained and production-ready?
Maintenance appears limited: the package has roughly 24 stars, zero dependents, and little ecosystem validation. The 1.0.2 release did address a PHP 8.2 deprecation, so maintenance has not completely stopped, but one patch is not evidence of a sustained cadence. For stable color math with a small surface area this may be acceptable, but treat it as a commodity utility rather than a strategic dependency.
How should I handle invalid color input or alpha values in primal/color?
Documented behavior for invalid color strings, missing alpha values, out-of-gamut channels, and rounding is not clearly specified, so write contract tests around those cases. Normalize and validate input in your own adapter before passing it to the package, and decide explicitly whether invalid input should throw, return null, or fall back to a default. This also makes it easier to replace the library later.
What are alternatives to primal/color, and can I swap it out later?
Alternatives include well-maintained color libraries with clear licenses or a small internal helper for hex, RGB, and HSL conversion. Because the algorithms are simple and stable, replacing primal/color is straightforward if you introduce an application-owned interface and adapter from day one. Keep package-specific color value objects out of your public APIs so swapping implementations does not change call sites.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager