How to Inspect and Debug CSS color-mix in Safari Web Inspector

In modern web interface engineering and design system architecture, generating dynamic color palettes\u2014such as hover states, subtle surface tints, translucent borders, and accessible contrast variations\u2014is now possible directly in CSS using the color-mix() functional notation. Part of the CSS Color Module Level 4 specification, color-mix() allows developers to blend two colors in specified proportions across diverse color spaces (such as srgb, oklch, lab, or display-p3). In Safari on macOS, inspecting mixed color output, verifying color-space interpolation paths, and testing gamut fallbacks is fully supported inside Safari Web Inspector.

Understanding the CSS color-mix() Syntax and Color Spaces

The standard syntax for mixing colors in CSS is:

color-mix(in <color-space>, <color-1> [<percentage-1>], <color-2> [<percentage-2>])

Key parameters include:

  • Interpolation Color Space: Specifies the mathematical space where colors are calculated. Using in srgb can result in muddy, desaturated intermediate shades (known as the “gray dead zone”). Mixing in perceptual spaces like in oklch maintains uniform perceived lightness and vibrant chroma.
  • Hue Interpolation Methods: For polar/cylindrical color spaces (hsl, hwb, lch, oklch), you can specify how hues traverse the color wheel (e.g., shorter hue, longer hue, increasing hue, or decreasing hue).
  • Percentages: Optional weighting values. If one percentage is omitted, it automatically complements the other to equal 100%.

Opening Safari Web Inspector and Selecting Styled Elements

To inspect elements utilizing color-mix() in Safari:

  1. Open Safari on macOS.
  2. Ensure developer tools are enabled via Safari > Settings > Advanced > Show features for web developers.
  3. Right-click the styled component (such as a tinted card background, button, or badge) and choose Inspect Element (or press Option + Command + I).
  4. In the Elements DOM tree, select the target element.
  5. In the right-hand Styles panel, locate the rule containing color-mix().

Inspecting and Testing color-mix in the Styles Panel

Consider a button with a dynamically generated hover tint:

.btn-primary {
  background-color: color-mix(in oklch, var(--brand-color) 85%, white);
  border: 1px solid color-mix(in srgb, var(--brand-color) 60%, black);
}

Safari Web Inspector renders an interactive color swatch directly beside the color-mix() declaration:

  • Visual Swatch Preview: The small square swatch displays the exact computed, rendered color produced by WebKit\u2019s graphics engine.
  • Shift-Click Format Switching: Hold Shift and click the color swatch to cycle the computed output between HEX, RGB, HSL, and OKLCH notations.
  • Live In-Place Editing: Double-click the percentage values (e.g., 85%) or color variables and use the Up/Down arrow keys to tweak blending ratios in real time.

Comparing Color Space Interpolation Differences

To see why choosing the correct color space is vital for design fidelity:

  1. In the Styles panel, edit the color space identifier inside color-mix().
  2. Change:
    color-mix(in srgb, blue 50%, yellow 50%)
    To:
    color-mix(in oklch, blue 50%, yellow 50%)
  3. Notice the rendered swatch:
    • In srgb, mixing blue and yellow yields an unattractive murky gray.
    • In oklch, mixing blue and yellow yields a clean, vibrant green hue.

Testing Display-P3 and Wide-Gamut Mixing

On modern Apple displays (such as MacBook Pro Liquid Retina XDR and Studio Displays), screens support wide-gamut Display-P3 color reproduction:

.accent-badge {
  background-color: color-mix(in display-p3, color(display-p3 1 0 0) 70%, white);
}

Web Inspector verifies whether the computed color output falls within the standard sRGB gamut or requires P3 hardware capabilities. If the color cannot be displayed on a standard monitor without clipping, WebKit\u2019s color picker highlights the gamut boundary, ensuring cross-device consistency.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.