laravel-validation-rules/colour
Laravel validation rules for colour values. Validate CSS colour formats such as hex, RGB, RGBA, HSL and HSLA, plus named colours, using simple rule objects you can drop straight into form requests and validators.
rgb()/rgba(), hsl(), CSS named colours) and consistent error messaging — so the decision is really "do we want to own multi-format colour grammar?" For most teams the answer is no.rgb, and sometimes hsl), this is the validation layer that unblocks the parser/converter work behind it. It is an enabler, not a differentiator — the 0.38 opportunity score reflects that colour validation is a commodity capability with no competitive moat.Adopt when:
laravel-validation-rules/* siblings or similar micro-packages).Validator::make rather than embedded in controllers or frontend-only checks (frontend validation is a UX affordance, not a security boundary — server-side validation still matters).Look elsewhere — or just write a regex — when:
#RRGGBB from a colour picker you control). A four-line regex is cheaper than a dependency, its CVE feed, and its upgrade path.App\Rules\Colour so replacing it later is a one-file change — or vendor the logic outright; it's small enough to own.composer.json constraints before committing; an unmaintained constraint can block your framework upgrade, which is a far bigger cost than the feature is worth.For executives (30 seconds): "Users can currently type arbitrary text into colour fields, which produces broken themes, support tickets, and occasionally malformed CSS. There's an existing, permissively licensed (Apache-2.0) open-source component that solves this for Laravel. Cost is roughly half a day of integration plus near-zero ongoing cost. It is not a differentiator — competitors solve this trivially — but it closes a data-quality gap and removes a class of bug. Risk is low and bounded: it's small, isolated, and we'll wrap it so we can swap or replace it in an hour if it's ever abandoned."
For engineering: "Adds a Colour validation rule usable directly in FormRequests. Handles hex, rgb()/rgba(), hsl() and named colours so we stop maintaining bespoke regex per feature. Apache-2.0, so no licence review friction. Caveats: low activity (33 stars, last release Feb 2023) and it validates only — no contrast checking, no conversion. Two asks: (1) confirm the illuminate/validation and PHP constraints match our floor before we adopt; (2) wrap it in App\Rules\Colour so the dependency never leaks into feature code and we can fork the body if upstream goes quiet. If the wrapper feels like more work than the rule itself, that's a signal to just write the rule."
Framing to avoid: don't sell this as a capability or a moat. It's plumbing. The pitch is reduced surface area for bad data at negligible cost, with the maintenance question answered up front rather than discovered in eighteen months.
How can I help you explore Laravel packages today?