Documentation
¶
Overview ¶
Package theme holds Matinee's colour themes: the ones built in, and ones an admin adds by putting a theme file in the data directory's themes folder.
A theme is a small JSON file of colours and font names, never code, so it is safe to share. The server sends every client the full set of colours; the colours a file leaves out are worked out from the ones it gives (see Resolve). docs/themes.md describes the format for people making themes.
Index ¶
Constants ¶
const Default = "matinee"
Default is the theme people see until they or an admin pick another.
Variables ¶
var ( DisplayFonts = []string{"fraunces", "inter", "orbitron"} BodyFonts = []string{"inter"} )
DisplayFonts and BodyFonts are the typefaces bundled with the web player and the apps. Adding one means adding it to every client.
Functions ¶
Types ¶
type Color ¶
Color is an sRGB colour with alpha from 0 to 1.
func ParseColor ¶
ParseColor reads #rgb, #rrggbb, #rrggbbaa, rgb(r,g,b) or rgba(r,g,b,a).
type Colors ¶
type Colors struct {
// Required.
Ink string `json:"ink"` // the page behind everything
Surface string `json:"surface"` // panels and bars
Raised string `json:"raised"` // cards, inputs and buttons on a panel
Line string `json:"line"` // borders and dividers
Text string `json:"text"` // body text and titles
Muted string `json:"muted"` // secondary text
Faint string `json:"faint"` // hints and the least important text
Accent string `json:"accent"` // the main button, links, what has focus
// Optional; Resolve works them out from the ones above.
AccentStrong string `json:"accentStrong"` // the accent when pressed or hovered
OnAccent string `json:"onAccent"` // text on an accent button
Danger string `json:"danger"` // errors and deleting
Glow string `json:"glow"` // the halo around what has focus on a TV
Glass string `json:"glass"` // frosted buttons over artwork
GlassFocused string `json:"glassFocused"` // a frosted button with focus
Scrim string `json:"scrim"` // behind the video player
Track string `json:"track"` // a progress bar's unplayed part
Shade string `json:"shade"` // dark wash under text on artwork
Veil string `json:"veil"` // tints a backdrop towards the page
}
Colors are CSS colours: #rgb, #rrggbb, #rrggbbaa or rgba(r,g,b,a).
type Fonts ¶
type Fonts struct {
Display string `json:"display"` // titles and headings
Body string `json:"body"` // everything else
}
Fonts name typefaces from the set every client ships (DisplayFonts and BodyFonts), since a TV can't load fonts from a theme.
type Theme ¶
type Theme struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Author string `json:"author,omitempty"`
// Scheme is "dark" or "light": what the system's own controls (scroll
// bars, keyboards, alerts) should match.
Scheme string `json:"scheme"`
Fonts Fonts `json:"fonts"`
Colors Colors `json:"colors"`
// BuiltIn is set by the server for the themes that ship with Matinee.
BuiltIn bool `json:"builtIn"`
}
Theme is a theme file, and with Resolve, what the clients are sent.
func Builtin ¶
func Builtin() []Theme
Builtin returns the themes that ship with Matinee, Default first.
func Load ¶
Load returns the built-in themes and the ones in dir, which may not exist. A file that isn't a valid theme is skipped and reported in problems, so one bad file doesn't hide the rest. A file can't replace a built-in theme.
func (Theme) Check ¶
Check lists what's hard to read in a theme: pairs of colours below WCAG AA contrast (4.5:1 for text, 3:1 for hints). Themes with warnings still load; the built-in ones have none.