mistic100/randomcolor
Generate attractive random colors in PHP (port of David Merfield’s randomColor). Create single or multiple colors with options for hue, luminosity, alpha, and output formats like hex, rgb(a), hsl(a), or hsv(a). Supports custom PRNG.
light, dark, bright) and hue constraints (e.g., "only blues").RandomColor::many(10, ['hue' => 'green']) for 10 chart series). Reduces back-and-forth with designers.if ($user->premium) return '#FFD700';).RandomColor::one(['hue' => $tenant->brandColor])).Adopt if:
RandomColor::one()).Avoid if:
random_int() + manual HSL conversion.Consider Alternatives if:
For Executives: "This package lets us automate color generation for features like user profiles, data visualizations, or promotions—eliminating design bottlenecks while keeping our UI dynamic and engaging. It’s a lightweight, MIT-licensed solution used by 242+ projects, cutting dev time by 80% compared to custom code. For example, we could auto-generate color schemes for our analytics dashboard in one line of code, improving iteration speed without sacrificing quality. The demo (strangeplanet.fr/work/RandomColor.php) shows how it produces attractive, accessible colors on demand—ideal for scaling features like multi-tenant theming or gamified interactions."
For Engineering:
*"A PHP port of the popular JavaScript randomColor library, this gives us:
#FF5733), RGB (rgb(255,87,51)), HSL, or CSS-compatible strings—no manual conversions.'green'), luminosity ('light', 'dark'), or transparency (alpha: 0.5).User::color).
Use cases:RandomColor::many(5, ['hue' => 'blue']) for 5 distinct chart colors.RandomColor::one(['luminosity' => 'light'])).randomColor.js).
Demo: Live preview."*For Designers: *"This tool generates visually appealing colors that align with our brand while giving us flexibility for dynamic features. Key benefits:
RandomColor::many(10, ['hue' => 'green']).
Trade-off: Less control than manual design, but faster iteration for non-critical visuals."*How can I help you explore Laravel packages today?