Skip to main content

Crate weirdnet_themes

Crate weirdnet_themes 

Source
Expand description

Themes: <themes dir>/<name>/interface.toml with [meta], [dark] and [light] variants.

Brand- and app-free: the caller supplies where themes live (ThemeDirs) and its own preference type converts into Mode. See the README for the features.

Modules§

detect
System light/dark detection: terminal background (OSC 11), then the OS preference, else dark.

Structs§

Meta
PlainDir
A plain folder: std::fs with the platform’s default permissions.
ThemeFile
VariantDef

Enums§

ColorDepth
Terminal color depth.
Mode
Light, dark, or follow the system. The app’s preference type converts into it.
ThemeError
Variant

Constants§

BUILTINS
Built-in themes compiled into the binary.
DEFAULT_THEME
MIN_CONTRAST
ROLES
Semantic roles every variant must define.
THEME_FILE
The file holding one theme inside its folder.

Traits§

ThemeDirs
Where themes live and how they are written. The app implements it, so this crate owns no home-directory layout or file-permission policy.

Functions§

active
Load the active theme; falls back to the default if the configured one is broken.
builtin
contrast
WCAG contrast ratio (1..21).
contrast_warnings
Contrast warnings for a variant (fg/bg pairs).
list
Theme folder names, built-ins first in their fixed order.
load
luminance
WCAG relative luminance.
materialize
Write built-in themes to themes/<name>/ when missing.
nearest_256
Nearest xterm-256 index.
parse_hex
reset
Restore the shipped version of a built-in theme.
resolve_variant
Resolve the active variant from a mode.
save
to_hex
valid_name

Type Aliases§

Result