Gatsby Color Palette Generator
Generate accessible, harmonious color palettes for Gatsby projects. Export to CSS variables, Theme UI, and Styled Components instantly.
About
Color harmony is not random; it is a mathematical relationship between frequencies of light. This Gatsby Color Palette Generator utilizes the HSL (Hue, Saturation, Lightness) color space to algorithmically derive harmonious color schemes. Unlike RGB, which is digital-centric, HSL models human perception, allowing for precise manipulation of tints and shades while maintaining tonal consistency.
Designed specifically for modern web development workflows, this tool calculates WCAG 2.1 contrast ratios in real-time to ensure your design is accessible. Whether you use Theme UI, Styled Components, or native CSS, the generator produces production-ready code snippets that can be dropped directly into your gatsby-config.js or layout files.
Formulas
The core algorithm converts the input HEX to HSL, rotates the hue vector, and reconverts to HEX. The Hue rotation for a generated color Ci is defined as:
To ensure accessibility, we calculate the Relative Luminance L to determine the contrast ratio R:
Where L1 is the luminance of the lighter color and L2 is the darker. A ratio ≥ 4.5:1 is required for AA standard compliance.
Reference Data
| Harmony Rule | Hue Formula (θ) | Description |
|---|---|---|
| Analogous | H ± 30° | Colors next to each other. Serene and comfortable designs. |
| Complementary | H + 180° | High contrast. Best for call-to-action buttons. |
| Split-Complementary | H + 150°, 210° | Strong visual contrast with less tension than complementary. |
| Triadic | H + 120°, 240° | Balanced and vibrant. requires careful balance of dominance. |
| Tetradic (Rectangle) | H + 60°, 180°, 240° | Rich color variety. Hardest to balance. |
| Monochromatic | H + 0° | Variations in S and L only. |