Documentation
¶
Overview ¶
Package theme builds ZPad's palettes for the native UI and the editor.
Index ¶
- Constants
- func ActiveTab(t *ui.Theme) ui.Color
- func Dark() *ui.Theme
- func EditorTheme(t *ui.Theme) *editor.Theme
- func FileTree(t *ui.Theme) *ui.Theme
- func For(dark bool) *ui.Theme
- func Inverse(t *ui.Theme) (fill, text ui.Color)
- func Light() *ui.Theme
- func Normalize(id string) string
- func ResultList(t *ui.Theme) *ui.Theme
- func Sidebar(t *ui.Theme) ui.Color
- func TabBar(t *ui.Theme) ui.Color
- type Chrome
- type Definition
Constants ¶
const ( SystemID = "system" LightID = "light" DarkID = "dark" )
Theme ids of the default pair and of following the desktop.
Variables ¶
This section is empty.
Functions ¶
func EditorTheme ¶
EditorTheme colors the code editor to match t.
func FileTree ¶
FileTree returns the palette of the sidebar's tree: the chosen row is a faint, full-width wash rather than a filled accent, as VS Code's and Zed's file trees, and its text keeps the normal color.
func Inverse ¶
Inverse is the fill of a tip and the color of text on it, as MyGo's own tooltip and toast choose them: the theme's Inverse and InverseText where it sets them, the text on the background otherwise. A tip that MyGo cannot place shares the look of the ones it can.
func Normalize ¶ added in v0.5.0
Normalize returns id when it names a theme, the system setting for anything else, so that a settings file written by hand cannot leave the app with no palette.
func ResultList ¶ added in v0.4.0
ResultList returns the palette of the search results: the chosen row is a faint wash too, so the highlight of the match inside it stays visible.
Types ¶
type Definition ¶ added in v0.5.0
type Definition struct {
ID string
Name string
Dark bool
UI *ui.Theme
FileTree *ui.Theme
ResultList *ui.Theme
// Chrome colors the sidebar, the tab bar and the chosen tab.
Chrome Chrome
Code *editor.Theme
}
Definition is one selectable theme: the UI palette, the colors of the window parts that ui.Theme has no fields for, and the editor's palette. The default light and dark themes keep the colors they always had; the named themes are built from a handful of seed colors.
func Default ¶ added in v0.5.0
func Default(dark bool) *Definition
Default returns the default theme for an appearance.
func Lookup ¶ added in v0.5.0
func Lookup(id string) (*Definition, bool)
Lookup returns the theme with id, including the default light and dark themes, or false when no such theme exists.
func Named ¶ added in v0.5.0
func Named() []*Definition
Named returns the named themes in display order, default light and dark excluded.
func Resolve ¶ added in v0.5.0
func Resolve(id string, systemDark bool) *Definition
Resolve returns the theme a setting stands for: the named one when it exists, the default theme for an appearance otherwise (also for "system"), or the default light theme for an unknown id.