File size: 671 Bytes
7843436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * Shared theming constants used by both the editor (to preview primary color
 * changes live) and the publisher (to bake them into the published HTML).
 *
 * Keep lightness/chroma here as the single source of truth. CSS `_variables.css`
 * still owns the *default* primary hue; this module only defines the L/C pair
 * shared by the HueSlider preview and the server-side override.
 */

export const OKLCH_L = 0.75;
export const OKLCH_C = 0.12;

/** Format an OKLCH color string using the shared L/C and a given hue (0-360). */
export function oklchFromHue(hue: number): string {
  const h = ((hue % 360) + 360) % 360;
  return `oklch(${OKLCH_L} ${OKLCH_C} ${h})`;
}