Files
OpsLog/internal/qslcard/presets.go
T
2026-06-13 10:14:23 +02:00

129 lines
4.6 KiB
Go

package qslcard
// Preset describes one named typography style (a layer-stack recipe the
// frontend renders as SVG). AllowedParams whitelists the style_params keys
// the preset understands; Validate rejects anything else.
type Preset struct {
Name string `json:"name"`
Label string `json:"label"`
AllowedParams map[string]bool `json:"-"`
Defaults StyleParams `json:"defaults"`
}
// gelParams are the knobs shared by the layered "gel" stacks.
var gelParams = map[string]bool{
"gradient": true, "shine": true, "outline_color": true, "outline_width": true,
"halo": true, "shadow": true, "bevel_offset": true, "fx": true,
}
// Presets is the built-in style registry, keyed by preset name.
var Presets = map[string]Preset{
"gel_gold": {
Name: "gel_gold",
Label: "Gel gold",
AllowedParams: gelParams,
Defaults: StyleParams{
Gradient: []string{"#FFE22D", "#FFD600", "#FFCC00"}, // bright XV9Q yellows; orange depth comes from the FX inner shadow
Shine: &Shine{Coverage: 0.6, Opacity: 1},
OutlineColor: "#2a3f5c", OutlineWidth: 10,
Halo: &Halo{Color: "#cdd9e4", Blur: 6, Opacity: 0.4},
Shadow: &ShadowFx{Dx: 6, Dy: 9, Blur: 5, Color: "#14243a", Opacity: 0.55},
BevelOffset: &Bevel{Dx: -3, Dy: -6, Dark: "#A85F00", Light: "#FFF6C8"},
},
},
"gel_silver": {
Name: "gel_silver",
Label: "Gel silver",
AllowedParams: gelParams,
Defaults: StyleParams{
Gradient: []string{"#FBFDFF", "#C9D4DE", "#8496A8"},
Shine: &Shine{Coverage: 0.52, Opacity: 0.95},
OutlineColor: "#3c4654", OutlineWidth: 10,
Halo: &Halo{Color: "#dfe7ee", Blur: 6, Opacity: 0.4},
Shadow: &ShadowFx{Dx: 6, Dy: 9, Blur: 5, Color: "#1b2530", Opacity: 0.55},
BevelOffset: &Bevel{Dx: -3, Dy: -6, Dark: "#67788b", Light: "#FFFFFF"},
},
},
"gel_gold_grunge": {
Name: "gel_gold_grunge",
Label: "Gel gold (vintage)",
AllowedParams: gelParams,
Defaults: StyleParams{
Gradient: []string{"#FFC83A", "#F0A21E", "#D87A00"},
Shine: &Shine{Coverage: 0.42, Opacity: 0.8},
OutlineColor: "#1c130a", OutlineWidth: 11,
Halo: &Halo{Color: "#d8c08a", Blur: 5, Opacity: 0.3},
Shadow: &ShadowFx{Dx: 5, Dy: 8, Blur: 4, Color: "#1a0f04", Opacity: 0.55},
BevelOffset: &Bevel{Dx: -2, Dy: -4, Dark: "#A85F00", Light: "#FFE08A"},
},
},
"gel_silver_grunge": {
Name: "gel_silver_grunge",
Label: "Gel silver (vintage)",
AllowedParams: gelParams,
Defaults: StyleParams{
Gradient: []string{"#EEF2F6", "#C2CDD8", "#8593A3"},
Shine: &Shine{Coverage: 0.42, Opacity: 0.8},
OutlineColor: "#16191f", OutlineWidth: 11,
Halo: &Halo{Color: "#cdd6df", Blur: 5, Opacity: 0.3},
Shadow: &ShadowFx{Dx: 5, Dy: 8, Blur: 4, Color: "#10141a", Opacity: 0.55},
BevelOffset: &Bevel{Dx: -2, Dy: -4, Dark: "#6c7d8f", Light: "#FFFFFF"},
},
},
"classic_white_outline": {
Name: "classic_white_outline",
Label: "Classic white outline",
AllowedParams: map[string]bool{
"gradient": true, "outline_color": true, "outline_width": true, "shadow": true,
},
Defaults: StyleParams{
Gradient: []string{"#FFD83A", "#FFC312", "#EE9400"},
OutlineColor: "#ffffff", OutlineWidth: 11,
Shadow: &ShadowFx{Dx: 4, Dy: 6, Blur: 6, Color: "#1c2b3d", Opacity: 0.45},
},
},
"script_white": {
Name: "script_white",
Label: "Script white",
AllowedParams: map[string]bool{
"color": true, "outline_color": true, "outline_width": true, "shadow": true,
},
Defaults: StyleParams{
Color: "#ffffff",
OutlineColor: "#22364e", OutlineWidth: 2,
},
},
"outlined_white": {
Name: "outlined_white",
Label: "Outlined white",
AllowedParams: map[string]bool{
"color": true, "outline_color": true, "outline_width": true,
},
Defaults: StyleParams{
Color: "#ffffff",
OutlineColor: "#22364e", OutlineWidth: 5,
},
},
"flat_modern": {
Name: "flat_modern",
Label: "Flat modern",
AllowedParams: map[string]bool{"color": true},
Defaults: StyleParams{Color: "#ffffff"},
},
}
// Layout archetypes produced by the placement engine.
const (
ArchetypeSideColumn = "side_column" // inserts stacked in a side column
ArchetypeBottomStrip = "bottom_strip" // inserts in a strip along the bottom
ArchetypeFullBleed = "full_bleed" // hero photo only, no inserts
)
// Built-in fonts (embedded OFL files in assets/fonts; see fonts.go). The
// names match the @font-face family names registered in the frontend.
const (
FontDisplayDefault = "Archivo Black"
FontScriptDefault = "Great Vibes"
FontInfoLine = "system-bold-sans"
)