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
- type Ask
- type Fade
- type FadeKind
- type Fill
- type Hints
- type Logo
- type LogoRaster
- type Progress
- type Prompt
- type PromptKind
- type Renderer
- func (r *Renderer) AddLogo(l *LogoRaster)
- func (r *Renderer) Crossfade(from, to State) State
- func (r *Renderer) Draw(f kms.Frame, scale int, prev *State, cur State) (kms.Damage, error)
- func (r *Renderer) Intro(s State) State
- func (r *Renderer) LastFrame(outputs []splashframe.Output) splashframe.LastFrame
- func (r *Renderer) Leave(s State) State
- func (r *Renderer) Logo(size image.Point, scale int) image.Rectangle
- func (r *Renderer) LogoColor() render.Color
- func (r *Renderer) NeedsLogo(scale int) bool
- func (r *Renderer) NextFill(s State, size image.Point, scale int) Fill
- func (r *Renderer) PhasesToNextPicture(s State, size image.Point, scale int) int
- type State
- type Theme
- type Throbber
Constants ¶
const ( CapsLockHint = "Caps Lock is on" EscHint = "Esc: boot messages" UpdateHint = "Do not turn off" )
const ( IntroPhases = 9 CrossfadePhases = 5 LeavePhases = 9 )
const ( FillPerPercent = 100 FullFill = Fill(protocol.MaxPercent) * FillPerPercent )
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 LogoRaster ¶
type LogoRaster struct {
// contains filtered or unexported fields
}
LogoRaster is the lys logo rasterized for a scale in a colour.
func RasterizeLogo ¶
func RasterizeLogo(scale int, c render.Color) (*LogoRaster, error)
RasterizeLogo draws the lys logo at scale in c, 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
Retry bool
}
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 ¶
func NewRenderer(t Theme, bgrt *splashframe.BGRT) (*Renderer, error)
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; one in a colour other than LogoColor, rasterized for a theme since replaced, is never drawn.
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, and while a fade runs the status group and the logo when it fades too.
func (*Renderer) LastFrame ¶
func (r *Renderer) LastFrame(outputs []splashframe.Output) splashframe.LastFrame
func (*Renderer) LogoColor ¶
LogoColor is the colour the renderer draws the lys logo in: the theme's accent, the throbber's and the bar's.
type State ¶
type State struct {
Hidden bool
Message string
Status string
Prompt Prompt
Ask Ask
Hints Hints
Updating bool
Progress Progress
Phase int
Leaving bool
Fade Fade
}
State is what the splash shows.
func (State) AdvanceFade ¶
func (State) CapsLockShown ¶
func (State) KeymapShown ¶
func (State) WithPrompt ¶
type Theme ¶
type Theme struct {
Background render.Color
Foreground render.Color
Secondary render.Color
Accent render.Color
Error render.Color
Logo Logo
Throbber Throbber
// Units shows the name of each unit systemd starts on the status line.
Units bool
PromptHints bool
ReducedMotion bool
}
Theme is a validated theme.