Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Themes = []Theme{ThemeClassic, ThemeDark, ThemeColorblind}
Themes lists every theme in presentation order.
Functions ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
Up, Down, Left, Right key.Binding
Reveal, Flag, Chord key.Binding
New, Restart, Difficulty key.Binding
Menu, Stats, Help key.Binding
Quit key.Binding
}
KeyMap defines key bindings.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the bubbletea model.
func (Model) Init ¶
Init implements tea.Model. A resumed game arrives with its clock already running, so the tick has to start without waiting for a first move.
type Options ¶
type Options struct {
Difficulty game.Difficulty
Seed game.Seed
Config storage.Config
HighScores storage.HighScores
Stats storage.Stats
NoColor bool
// Session, when set, is an unfinished game to pick up instead of dealing
// a new board.
Session *storage.Session
}
Options configures the UI run.
type Styles ¶
type Styles struct {
Hidden lipgloss.Style
Revealed lipgloss.Style
Flagged lipgloss.Style
Questioned lipgloss.Style
Mine lipgloss.Style
Cursor lipgloss.Style
Digits [9]lipgloss.Style
HUD lipgloss.Style
StatusBar lipgloss.Style
Overlay lipgloss.Style
Title lipgloss.Style
Warning lipgloss.Style
}
Styles holds lipgloss styles for rendering.
type Theme ¶ added in v0.3.0
type Theme string
Theme names a colour palette. The board is readable without colour at all, so a theme only changes how pleasant it looks — never what it means.
const ( // ThemeClassic is the light grey of the original Windows game. ThemeClassic Theme = "classic" // ThemeDark suits dark terminals, where the classic light cells glare. ThemeDark Theme = "dark" // ThemeColorblind swaps the red/green digits for the Okabe-Ito palette, // which stays distinguishable with the common forms of colour blindness. ThemeColorblind Theme = "colorblind" )
func ParseTheme ¶ added in v0.3.0
ParseTheme resolves a theme name, reporting whether it was recognised. The caller decides what an unknown name means: a typo on the command line is worth an error, whereas a stale config file should just fall back.