|
| 1 | +import type { ThemeMode, ThemePalette } from '@purestack/ts-style' |
| 2 | +import { paint, studioHues } from './studioSkinShared' |
| 3 | + |
| 4 | +export type DocumentationColors = ReturnType<typeof createDocumentationColors> |
| 5 | + |
| 6 | +/** Reading surfaces and their decorative accents, separate from the demo palette. */ |
| 7 | +export function createDocumentationColors( |
| 8 | + theme: ThemeMode, |
| 9 | + palette: ThemePalette, |
| 10 | +) { |
| 11 | + const neutral = paint(studioHues.neutral) |
| 12 | + const dark = theme === 'dark' |
| 13 | + const surface = dark ? neutral(0.265, 0.13) : neutral(0.99, 0.015) |
| 14 | + const shadow = neutral(0.15, 0.1, dark ? 0.16 : 0.045) |
| 15 | + |
| 16 | + return { |
| 17 | + canvas: dark ? neutral(0.235, 0.12) : neutral(0.975, 0.025), |
| 18 | + surface, |
| 19 | + ink: dark ? neutral(0.85, 0.08) : neutral(0.32, 0.12), |
| 20 | + heading: dark ? neutral(0.93, 0.06) : neutral(0.25, 0.15), |
| 21 | + muted: dark ? neutral(0.72, 0.1) : neutral(0.48, 0.12), |
| 22 | + border: dark ? neutral(0.36, 0.12) : neutral(0.88, 0.05), |
| 23 | + shadow, |
| 24 | + tint: `color-mix(in srgb, ${palette.semanticTone.accent.text.default} 6%, ${surface})`, |
| 25 | + elevation: `0 3px 12px ${shadow}, 0 16px 40px ${shadow}`, |
| 26 | + } |
| 27 | +} |
0 commit comments