-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.config.mjs
More file actions
57 lines (52 loc) · 2.56 KB
/
Copy paththeme.config.mjs
File metadata and controls
57 lines (52 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { loadColorSystemVariants, loadVariantKnobs } from './scripts/color-system.mjs'
import { colorDomain } from './scripts/theme-engine/domain-color/index.mjs'
import { obsidianEmitter } from './scripts/theme-engine/emit/obsidian.mjs'
import { vscodeEmitter } from './scripts/theme-engine/emit/vscode.mjs'
import { webEmitter } from './scripts/theme-engine/emit/web.mjs'
const variantSpec = loadColorSystemVariants()
const activeVariantKnobs = loadVariantKnobs()
function variantKnob(ref, description) {
const [groupId, knobId] = String(ref || '').split('.')
const values = activeVariantKnobs?.[groupId]?.[knobId]
if (!values) {
throw new Error(`theme.config.mjs: missing variant knob "${ref}"`)
}
return Object.freeze({
ref,
description,
values: Object.freeze({ ...values }),
})
}
export const themeKnobs = Object.freeze({
interactionAlpha: Object.freeze({
selection: variantKnob('interactionAlpha.selection', 'Selection overlay alpha.'),
focusRing: variantKnob('interactionAlpha.focusRing', 'Focus ring alpha after the opaque focus base is resolved.'),
}),
surfaceMix: Object.freeze({
panelLift: variantKnob('surfaceMix.panelLift', 'Panel lift from canvas toward ink.'),
gutterBand: variantKnob('surfaceMix.gutterBand', 'Gutter band mix from canvas toward ink.'),
borderBand: variantKnob('surfaceMix.borderBand', 'Structural border mix from canvas toward ink.'),
}),
interfaceMix: Object.freeze({
supportInk: variantKnob('interfaceMix.supportInk', 'Support ink mix intensity.'),
mutedInk: variantKnob('interfaceMix.mutedInk', 'Muted ink mix intensity.'),
subtleInk: variantKnob('interfaceMix.subtleInk', 'Subtle ink mix intensity.'),
shellRaised: variantKnob('interfaceMix.shellRaised', 'Raised shell fill mix intensity.'),
navActiveFill: variantKnob('interfaceMix.navActiveFill', 'Active navigation fill mix intensity.'),
navInactiveFill: variantKnob('interfaceMix.navInactiveFill', 'Inactive navigation fill mix intensity.'),
}),
guidanceMix: Object.freeze({
guide: variantKnob('guidanceMix.guide', 'Guide rail mix intensity.'),
}),
guidanceAlpha: Object.freeze({
bracketMatchFill: variantKnob('guidanceAlpha.bracketMatchFill', 'Bracket match fill alpha.'),
bracketMatchStroke: variantKnob('guidanceAlpha.bracketMatchStroke', 'Bracket match stroke alpha.'),
}),
})
export const themeConfig = Object.freeze({
domain: colorDomain,
emitters: Object.freeze([webEmitter, vscodeEmitter, obsidianEmitter]),
knobs: themeKnobs,
variants: Object.freeze([...variantSpec.variants]),
})
export default themeConfig