Overview

Goldilocks-CSS is built using OKLCH because it is perceptually uniform. Unlike traditional formats like HEX, RGB, or HSL, OKLCH aligns with how the human eye actually perceives color, which is critical for building accessible and professional interfaces. Key benefits of OKLCH include:

  • Consistent Perceived Brightness - In older formats like HSL, a "lightness" of 50% looks very different depending on the hue. For example, HSL yellow looks much brighter than HSL blue at the same 50% value. OKLCH Benefit: If you set two colors to `L: 55%`, they will appear to have the exact same brightness to the human eye. This makes creating accessible compliant scales much easier.
  • Predictable Color Scales - This OKLCH-based UI creates 9-shade scales by simply adjusting the Lightness and Chroma values. Because the space is uniform, a 10-point jump in lightness feels the same whether you are working with primary or secondary colours. This prevents "muddy" or unexpectedly neon transitions in your UI palette.
  • Wide-gamut color support - Modern displays (like those on MacBooks, iPhones, and high-end monitors) can show more colors than the standard sRGB web palette. OKLCH allows developers to access the Display P3 color space safely. It enables the "vivid expression" shade without clipping or distorting the color on older screens.
  • Better Tinting and Mixing - This OKLCH-based UI uses a technique called Secondary-Tinted Surfaces, where backgrounds and shadows inherit a tiny amount of the secondary hue. In OKLCH, you can add a precise amount of Chroma to a grey without shifting its perceived brightness. This creates the "cool and calibrated" feel of elevated surfaces.
  • Intuitive Math for Designers - This OKLCH-based system defines colors by three clear coordinates: L (Lightness): How bright is it? (0%–100%); C (Chroma): How intense/saturated is it?; H (Hue): What color is it? (0–360°). This makes it easy to calculate relationships, such as the 217° separation between the Primary and CTA hues, ensuring they remain visually distinct and balanced.

There is a dark mode over-ride file that adjusts these colours to meet the needs of contrast in this mode. Typically, the decoration and notification colours are lightened to provide better contrast on a dark background.

Accessibility

Web colour accessibility is a complex area. WCAG 2.2 provides a detailed discussion on the need to meet web accessibility and provides commentary on proper use of colour. WebAim (the Institute for Disability Research, Policy, and Practice) has a detailed discussion on designing in accessible contrast.

In general, these are complex calculations that you can usually find in an on-line tool or contrast ratio calculator to help with colour contrast selection. The WCAG recommendation is to ensure that the contrast between two colours is at least 4.5:1.

Where the challenges occur is around selecting a background element colour that has text. For example, a yellow background with white text has a low contrast ratio unless the yellow background is very dark. This is usually not desired or interesting. This also applies to colours adjacent to yellow such as green and orange. Consequently, black text on these backgrounds has high contrast rather than white text that usually fails the contrast test. This is often where designers stumble.

The reverse is true for blue or red. White text on red or blue backgrounds has high contrast. Black text on these backgrounds often fails accessibility unless these backgrounds are very light.

The aforementioned calculator tools are highly recommended to try and test various hue, saturation and lightness settings to ensure that the website has the colours it needs as well as meeting accessibility requirements.

Theme Creation

Given the complexity of the work and the number of details that need to be addressed, it is often easier to use an appropriate AI to help with the selection of the main psychologically based theme colours. Below is the way that the Goldilocks-CSS theme was created. The various CSS variables can be seen at Customization.

This theme was generated by Claude Sonnet 4.6 Adaptive with the prompt:
  • Role: You are an expert UI/UX Designer specializing in modern, accessible, and user-friendly web applications.
  • Task: Create a detailed CSS based UI color theme that is engaging and approachable.
  • Goal: To meet modern web UI design practices and to ensure the design will be relevant for many years. Take inspiration from SaaS standard theme colors websites such as Zoom, Stripe, Dropbox, Slack and Airtable
  • Core Requirements:
    • Theme: The design should project professionalism and reliability with a background of sophistication and creativity.
    • Color Palette: Needs a primary color for branding, a secondary color to support the primary color and a separate call-to-action color that complements the primary color and stands out.
    • Styling: Must be modern, clean and minimalist.
  • Design Guidelines:
    • Provide some apple.com design thinking.
    • All colors expressed as oklch values.
    • Must meet WCAG accessibility requirements.
    • Secondary color should support primary color and be sufficiently differentiated from the link color.
    • Call to action color should be more complementary to the primary color.
    • Include vibrant colors for link, success, warning and danger states. These colors need to have sufficient differentiation from the main colors. The warning color should be more biased to the yellow.
    • Include a separate set of colors for grey scale from white to black that has a dash of secondary color.
    • Include three crisp and tight shadow values for showing element elevation. These shadows should include a hint of secondary color.
    • Include background white colors lightly tinted with the secondary color for the main page.
    • Include three elevations of background also tinted with the secondary color. Elevations should have a smaller blur area and should have an inset color.
    • Include colors adjusted for dark mode display.
  • Output Format: Provide the UI as a single-file downloadable HTML file. Include a brief explanation of design choices.
Claude Response

Velo UI draws on Stripe's electric confidence, Zoom's trustworthiness, Dropbox's clarity, Slack's energy, and Airtable's creativity — unified by perceptually uniform OKLCH with secondary-tinted surfaces at every elevation.

Design Choices:

Primary 262° Violet-Indigo with 8.91:1 AAA
Secondary 182° Blue-Teal with 6.80:1 AA
CTA 45° Amber-Orange with 7.62:1 AAA

Role Name Hue OKLCH Rationale
Primary (60%) Violet-Indigo 262° oklch(42.2% 0.220 262) — Stripe/Slack DNA — blue enough to trust, violet enough to be remembered.
Secondary (30%) Blue-Teal 182° oklch(40.8% 0.210 182) — 80° from primary; 43° from link (225°) — clearly differentiated from interactive elements
CTA (10%) Amber-Orange 45° oklch(55.8% 0.205 45) — 217° from primary (near-complement). The classic SaaS blue + orange pairing

Why OKLCH?

Every color is expressed in OKLCH (Oklab Lightness, Chroma, Hue):

  • uniformity: -Equal lightness values appear equally bright regardless of hue, making contrast predictable and theming robust.
  • Wide-gamut ready: - Maps directly to modern display standards (P3, Rec.2020).
  • Future-proof: - As displays evolve, OKLCH ensures colors remain consistent and accessible.

Accessibility (WCAG 2.2 AA)

  • All text/background pairings meet 4.5:1 contrast for normal text and 3:1 for large text.
  • The grey scale is tuned so adjacent steps maintain at least 1.5:1 contrast, keeping subtle borders visible.
  • Semantic colors are vibrantly distinct from the primary palette to support color-blind users.

Apple-Inspired Design Thinking

  • Whitespace as structure: - Generous padding creates calm, breathable layouts.
  • Typography carries hierarchy: - Three text levels reduce reliance on heavy borders.
  • Shadows for elevation: - Three crisp, tight shadow values use layered low-alpha layers for natural depth — no glows, no heavy borders.
  • Purposeful color: - Color guides action and communicates state; it is never merely decorative.

Dark Mode Strategy

  • Surfaces shift to near-black with the same secondary undertone as light mode, preserving brand cohesion.
  • Shadows become more opaque to maintain depth against dark backgrounds.
  • Semantic colors shift to lighter tints to preserve vibrancy and readability.

Grey Scale

Chroma 0.005–0.014. Every grey subtly inherits secondary hue. Body text (g-800) on g-50: 17.61:1 AAA. Apple's macOS surface technique.