PURPOSE
Defines the shared 7-slot color model that unifies terrain and backdrop rendering under a single cohesive palette. A Palette is one color mood: terrain samples from 4 slots, backdrop samples from 5, with shadow and midtone shared across both. Swapping the active palette re-skins the whole scene in one step and keeps all surfaces internally consistent.
Authorship is hybrid — a PalettePreset declares parameters (temperature, brightness, saturation, optional hue_bias) and a generator produces the 7 hex slots. Presets may override individual slots by name when the algorithm produces something flat.
OWNS
- The
PaletteSlotstring-union type enumerating the seven slot names:shadow,midtone,bg_deep,bg_haze,bg_star,terrain_base,terrain_edge. - The
PaletteParamsinterface — the procedural-generation inputs (temperature,brightness,saturation, optionalhue_bias). - The
Paletteinterface — a fully resolved palette with anidplus the seven concrete hex strings, extendingPaletteParams. - The
PalettePresetinterface —PaletteParamsplusid,displayName, and an optionaloverridesPartial<Pick<Palette, ...slots>>for hand-tuned slot overrides.
READS FROM
Nothing. This file is pure type declarations with no imports.
PUSHES TO
Nothing at runtime. Consumed structurally by:
- The palette generator that turns
PalettePresetparameters into a resolvedPalette. - Terrain renderers (consume
shadow,midtone,terrain_base,terrain_edge). - Backdrop renderers (consume
shadow,midtone,bg_deep,bg_haze,bg_star). - Preset tables that declare concrete
PalettePresetvalues.
DOES NOT
- Generate colors. The procedural mapping from
PaletteParamsto hex slots lives in the generator, not here. - Validate hex strings, parameter ranges, or override completeness.
- Register, store, or look up palettes by id.
- Apply overrides on top of generator output — that merge happens downstream.
- Define backdrop or terrain geometry, layering order, or blend modes.
- Export runtime values, defaults, or constants — types only.
Signals
None. This module declares no events, no observers, and no mutable state.
Entry points
PaletteSlot— slot-name string union, used wherever code needs to refer to a specific slot.PaletteParams— input shape for procedural generation.Palette— output shape consumed by renderers; extendsPaletteParamsand addsidplus the seven hex slots.PalettePreset— authored shape combiningPaletteParams,id,displayName, and optionaloverrides.
Pattern notes
- Shared-slot design:
shadowandmidtoneare intentionally referenced by both terrain and backdrop so the two layers visually tie together; the other slots are scoped to one surface. - Parameter axes are signed and normalized:
temperatureandbrightnessrun roughly-1..+1,saturation0..1, andhue_bias(when set) is in degrees0..360. Whenhue_biasis provided it pins the base hue andtemperatureis downgraded to a warm/cool accent bias around that hue. Palette extends PaletteParamskeeps the source parameters on the resolved object so downstream code can re-derive or audit how a palette was generated.overridesusesPartial<Pick<Palette, ...slot names>>rather thanPartial<Palette>to ensure only the seven slot fields can be overridden, neveridor the parameter axes.- Snake_case slot names (
bg_deep,terrain_base,hue_bias) are used deliberately for slot identifiers and parameter knobs, distinct from camelCase fields likedisplayName.