Documentation
¶
Overview ¶
Package palettepick resolves which TA / TA: Kingdoms palette should be used to render a given GAF.
Total Annihilation ships a single global palette (palettes/palette.pal) and every GAF in the install renders against it. TA: Kingdoms reuses the GAF container format but splits the palette out by asset: interface GAFs ship alongside a same-name .pcx whose embedded 256-color table is the GAF's palette, while unit/feature GAFs use a side-specific palette (one of aramon / taros / veruna / zhon for the base game, plus aiden / creon from the Iron Plague expansion).
Resolve performs the lookup in the order kbot considers most reliable:
- Caller-supplied override path (e.g. from a UI selector or --palette flag).
- Same-name .pcx adjacent to the GAF (TAK's documented convention).
- Same-base-name .pal under palettes/ (covers oddities like palettes/<gafname>.pal).
- Side prefix heuristic on the GAF basename — ara*/tar*/ver*/zon*/aid*/cre* map to the four kingdoms + the two Iron Plague factions.
- palettes/palette.pal from the VFS (matches what TA shipped).
- The embedded TA palette as a last-resort fallback.
Resolve never returns a nil palette: it always at least surfaces the embedded fallback.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
// Path is the VFS path (empty for the embedded sentinel).
Path string
// Label is the short human-readable name.
Label string
// Source is the lookup category this candidate would be classified as.
Source Source
}
Candidate is a labelled palette source the UI can offer to the user. It describes a palette without loading it.
func Candidates ¶
Candidates returns the full menu of palettes that make sense for gafPath: the auto-resolved default first, then every available palettes/*.{pal,pcx} the VFS exposes, ending with the embedded fallback. The list is suitable for populating a palette picker dropdown.
Auto-resolution failures don't propagate — if the auto pick errors out, it's simply omitted from the menu (the embedded sentinel is always present).
type Result ¶
type Result struct {
Palette *gaf.Palette
Source Source
// Path is the VFS path the palette came from, or empty for the embedded
// fallback. For SourceSidecarPCX it's the .pcx that supplied the palette;
// for SourceSidePalette it's e.g. "palettes/aramon.pcx".
Path string
// Label is a short human-readable description suitable for surfacing in
// the UI (e.g. "aramon", "actionbuttons.pcx", "palette.pal").
Label string
}
Result captures the palette plus enough provenance for diagnostics, cache keys, and UI labels.
func Resolve ¶
Resolve returns the palette that should be used to render gafPath. If override is non-empty it is loaded directly (and failures bubble up). A caller passing override == "" gets the documented auto-detection chain.
vfs may be nil — in that case auto-detection skips every VFS-based step and falls back to the embedded palette.