package theme
import "git.teletypegames.org/engines/inkwell/theme"
Package theme holds the Theme type, its Manager and the preset themes.
A Theme is a named set of colour tokens every built-in widget draws with: the panel and status line, the verb buttons, the inventory slots, the speech bubble, the dialog box (whose tokens the menus use too), the end card, the cursor and hotspot outline, the scene backdrop, and the top bar, chat log and character panel. Widgets read the active theme every frame, so a switch shows on the next draw.
Presets
Presets returns the four shipped themes and RegisterPresets adds them to a manager, leaving alone any name already taken, so a game that hands over its own ThemeManager keeps everything in it. inkwell.New does this and selects Game.StartTheme, or classic-scumm.
- classic-scumm: the SCUMM-era dark blue with warm amber accents (the default).
- sierra-coin: darker purple and orange, designed for the verb-coin layout.
- paper-notebook: cream paper and ink, with a touch of sepia.
- terminal-green: retro phosphor green on black.
Custom themes
A theme is registered like any other entity and selected by pointer:
noir := g.ThemeManager.Register(&inkwell.Theme{
Name: "midnight-noir",
PanelBG: color.RGBA{6, 6, 12, 255},
StatusText: color.White,
// … the other colour tokens
})
g.UseTheme(noir)
The UseTheme action does the same mid-script and saves the setting, so a choice on a settings screen is kept. The active theme is remembered by Name.
Index
Functions
func RegisterPresets
func RegisterPresets(m *Manager)
RegisterPresets installs the built-in themes into a manager, skipping any name the caller has already taken.
Types
type Manager
type Manager = inkbase.Manager[*Theme]
Manager is the registry of themes, keyed by Theme.Name and kept in registration order; see inkbase.Manager.
func NewManager
func NewManager() *Manager
NewManager returns an empty Manager of themes.
type Theme
type Theme struct { Name string PanelBG color.Color StatusText color.Color FlashText color.Color VerbButtonBG color.Color VerbButtonSelectedBG color.Color VerbButtonText color.Color InventorySlotBG color.Color InventorySlotSelectedBG color.Color SpeechBubbleBG color.Color SpeechDefaultText color.Color DialogBG color.Color DialogBorder color.Color DialogChoiceBG color.Color DialogChoiceHover color.Color DialogSpeaker color.Color DialogText color.Color EndCardBG color.Color EndCardText color.Color CursorColor color.Color HotspotOutline color.Color // SceneBackdrop is painted before the scene background. Useful for // letterboxing or filling areas not covered by a smaller backdrop. SceneBackdrop color.Color // Rich-UI widgets (TopBar, CharacterPanel, ChatLog). TopBarBG color.Color TopBarText color.Color TopBarAccent color.Color // score / highlighted number color ChatLogBG color.Color ChatLogPrompt color.Color // "> look at door" lines ChatLogResponse color.Color // in-world reply lines ChatLogSystem color.Color // system / meta lines CharacterPanelBG color.Color CharacterPanelBorder color.Color CharacterPanelTitle color.Color // "PLAYER" / "NPC" badge color }
Theme is a registry-stored entity carrying every color the built-in widgets read. Multiple themes can be registered; the active one is addressed by name on the Game.
func Presets
func Presets() []*Theme
Presets returns the four built-in themes: classic-scumm, sierra-coin, paper-notebook and terminal-green. New calls RegisterPresets so a game that never mentions a theme still has one.
func (Theme) GetName
func (t Theme) GetName() string
GetName returns the theme's Name, the key it is registered under.
func (Theme) TypeLabel
func (t Theme) TypeLabel() string
TypeLabel returns "theme", the kind that tells a theme apart from other entities of the same Name in saved state and in panic messages.