Documentation
¶
Overview ¶
Package theme is how the splash looks: the validated theme.yaml, and the drawing of a frame from the splash's state, damage included, with no KMS underneath so tests can render it.
Index ¶
Constants ¶
const BGRTDir = "/sys/firmware/acpi/bgrt"
BGRTDir is where Linux exposes the ACPI BGRT table.
const CapsLockHint = "Caps Lock is on"
const Frames = 36
Frames is how many steps one turn of the throbber takes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BGRT ¶
BGRT is the logo the firmware left on screen: its image and where the firmware drew it, in the firmware's own pixels.
type LogoRaster ¶
type LogoRaster struct {
// contains filtered or unexported fields
}
LogoRaster is the lys logo rasterized for a scale.
func RasterizeLogo ¶
func RasterizeLogo(scale int) (*LogoRaster, error)
RasterizeLogo draws the lys logo at scale, milliseconds of work that does not belong on the frame loop and needs no Renderer.
type Prompt ¶
type Prompt struct {
Kind PromptKind
Text string
Shown string
}
Prompt is the question on screen and what is shown of the answer typed so far: one bullet per character for a password, the text for a question.
type PromptKind ¶
type PromptKind uint8
PromptKind is what a prompt asks for.
const ( NoPrompt PromptKind = iota PasswordPrompt QuestionPrompt )
The prompt kinds.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer draws frames from states with one theme. It is not safe for concurrent use.
func NewRenderer ¶
NewRenderer prepares drawing with t; bgrt is the firmware's logo, nil when it left none.
func (*Renderer) AddLogo ¶
func (r *Renderer) AddLogo(l *LogoRaster)
AddLogo keeps a logo for the frames at its scale.
func (*Renderer) Draw ¶
Draw brings frame f, shown at scale, from prev to cur and returns the rectangles it changed. With prev nil the whole frame is drawn; otherwise only the pixels whose state differs are redrawn: the entry for a key typed, the text's extent for a message, the columns between two fills of a bar.
func (*Renderer) PhasesToNextPicture ¶
PhasesToNextPicture is how many phases from phase the throbber shows a different picture.
type State ¶
type State struct {
Hidden bool
Message string
Prompt Prompt
Hints Hints
Updating bool
Booting bool
Progress protocol.Percent
Phase int
}
State is what the splash shows. Progress is the update's while Updating, and else the boot's while Booting.
func (State) CapsLockShown ¶
func (State) KeymapShown ¶
type Theme ¶
type Theme struct {
Background render.Color
Foreground render.Color
Accent render.Color
Logo Logo
Throbber Throbber
// Units shows the name of each unit systemd starts on the message line.
Units bool
PromptHints bool
}
Theme is a validated theme.