Files
OpsLog/internal/qslcard/presets.go
T
2026-06-11 21:54:35 +02:00

103 lines
3.5 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,
}
// 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{"#FFD83A", "#FFC312", "#EE9400"},
Shine: &Shine{Coverage: 0.5, Opacity: 0.95},
OutlineColor: "#2a3f5c", OutlineWidth: 9,
Halo: &Halo{Color: "#cdd9e4", Blur: 6, Opacity: 0.4},
Shadow: &ShadowFx{Dx: 5, Dy: 8, Blur: 5, Color: "#14243a", Opacity: 0.5},
BevelOffset: &Bevel{Dx: -2, Dy: -4, Dark: "#C27500", Light: "#FFEFA0"},
},
},
"gel_silver": {
Name: "gel_silver",
Label: "Gel silver",
AllowedParams: gelParams,
Defaults: StyleParams{
Gradient: []string{"#F4F7FA", "#C9D4DE", "#93A3B3"},
Shine: &Shine{Coverage: 0.5, Opacity: 0.95},
OutlineColor: "#3c4654", OutlineWidth: 9,
Halo: &Halo{Color: "#dfe7ee", Blur: 6, Opacity: 0.4},
Shadow: &ShadowFx{Dx: 5, Dy: 8, Blur: 5, Color: "#1b2530", Opacity: 0.5},
BevelOffset: &Bevel{Dx: -2, Dy: -4, Dark: "#76879a", 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"
)