pub struct Theme {Show 19 fields
pub wallpaper: Option<PathBuf>,
pub background: Color,
pub surface: Color,
pub foreground: Color,
pub accent: Color,
pub error: Color,
pub font: String,
pub mono_font: String,
pub font_size: f32,
pub clock_format: String,
pub date_format: String,
pub rounding: u32,
pub dim: f32,
pub blur: u32,
pub font_scale: f32,
pub warning: Color,
pub success: Color,
pub info: Color,
pub surfaces: Surfaces,
}Expand description
How the authentication screen looks.
Every field has a usable default, because a greeter that fails to render is a machine nobody can log into. A missing export, an unreadable wallpaper and a half-written file all have to degrade to “plain but working” rather than to nothing.
Fields§
§wallpaper: Option<PathBuf>Full path to the background image. None renders Self::background
flat, which is also the fallback when the file can’t be read.
background: ColorBehind everything, and behind the wallpaper while it loads.
surface: ColorThe panel the prompt sits on.
foreground: ColorText on surface.
accent: ColorThe focused/active colour — the same one window borders use.
error: ColorFailure text.
font: StringFont family name, as gsettings reports it. Not a path — the renderer resolves it through the system’s own font lookup, the same as every other app on the desktop.
mono_font: StringMonospace family, as gsettings’ monospace-font-name reports it —
for config lines, keys and values shown as they are written.
Empty means “the toolkit’s own monospace”, and is the default on
purpose rather than "Monospace": that name is a fontconfig
alias, and a renderer that looks families up by name rather than
through fontconfig finds no family called that and falls back to
the proportional default — which is the one font this field exists
to avoid. For the same reason a family that isn’t installed
resolves to empty too — gsettings will name one that isn’t.
font_size: f32Base point size before Self::font_scale is applied.
clock_format: Stringstrftime format for the clock. Empty hides it.
date_format: Stringstrftime format for the date, shown alongside the clock. Empty
hides it, same as Self::clock_format.
rounding: u32Corner radius, so the prompt matches window rounding.
dim: f32How much the wallpaper is dimmed behind the prompt, 0.0 to 1.0.
blur: u32Blur radius behind the prompt. 0 disables it.
font_scale: f32Scale applied to every text size, following the desktop’s own accessibility setting rather than a control of ours.
warning: ColorWarnings — a setting that won’t take effect, a conflicting bind.
success: ColorConfirmation that something applied.
info: Color“This is somewhere else” — a remote host, a mounted share, a network location.
Not a fifth shade of warning. It sits alongside
Self::warning, Self::success and Self::error as a
state colour, and it exists because the file manager’s design
reserves colour so that colour always means something: green for
good, orange for attention, red for danger, and this for
not-local. Without it a mounted share would have to borrow one
of the other three and quietly stop meaning what it says.
Dracula’s own cyan, unadjusted — the same choice
Self::accent and Self::error already make, and it holds
contrast against all four surfaces in the ramp.
surfaces: SurfacesThe elevation ramp the window apps are built from. The auth
screen only needs background and surface; a settings window
needs the steps in between.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn drawable_font_size(&self) -> f32
pub fn drawable_font_size(&self) -> f32
This theme’s font size, clamped to something that can actually be drawn.
iced_tiny_skia/cosmic-text assert a non-zero line height, so
a font size of 0.0 panics on the first frame — and the theme is
read from a file a person can edit, so 0 is reachable.
It lives here rather than in each host because it was copied into
three of them (the clipboard popup, the emoji popup and the tray
menu). The clipboard’s own copy said so: “if a third host ever
needs these bounds, they belong beside Theme in
hyprforge-look rather than being copied a third time”. The
third host arrived.
Sourcepub fn corner_radius(&self) -> f32
pub fn corner_radius(&self) -> f32
This theme’s corner rounding, bounded.
Hyprland’s own decoration:rounding has no upper limit, and a
huge one turns a popup into a lozenge or a circle. Same reason
and same three copies as Theme::drawable_font_size.
Sourcepub fn load(path: &Path) -> Result<Theme, ThemeError>
pub fn load(path: &Path) -> Result<Theme, ThemeError>
Reads a theme from path.
A missing file is the default theme, not an error: the greeter runs before anything has necessarily been exported, and refusing to draw would mean refusing to let anyone log in.
Sourcepub fn load_exported() -> Theme
pub fn load_exported() -> Theme
Reads the theme exported to export_dir, falling back to the
default.
Never returns an error. A greeter has nobody to report one to and nothing better to do than draw something usable — so a corrupt or unreadable export degrades to plain rather than to a blank screen.
No current caller: hyprforge-greet needs the --theme-dir
override that load_exported_from
takes and this fixed path doesn’t, so it calls that instead. Kept
for any other host that only ever reads the one export
(hyprforge-authui consumers besides the greeter, should one
exist).
Sourcepub fn load_exported_from(dir: &Path) -> Theme
pub fn load_exported_from(dir: &Path) -> Theme
load_exported against a named directory.
Split out so the degrade-to-default behaviour can be tested
without reading a real system path — and so a caller with its own
notion of where the export lives, like hyprforge-greet’s
--theme-dir, can use it too. The test that read a real path
instead asserted the export “won’t exist in a test environment”,
which stopped being true the moment the greeter was installed on
the machine running the tests — it then failed because the
product was working.
Sourcepub fn save(&self, path: &Path) -> Result<(), ThemeError>
pub fn save(&self, path: &Path) -> Result<(), ThemeError>
Writes the theme to path, as the lock screen reads it.
The wallpaper path is stored as-is, because the reader runs as
the same user and can follow it. export is the
version for a reader that cannot.
Sourcepub fn export(&self, dir: &Path) -> Result<Theme, ThemeError>
pub fn export(&self, dir: &Path) -> Result<Theme, ThemeError>
Writes the theme and a copy of its wallpaper into dir.
The wallpaper is copied, and the stored path rewritten to the copy. Referring to the original would leave the greeter with a path it cannot traverse — the failure this whole module exists to avoid — and it would break again the moment the image moved.
Returns the theme as written, which is not the theme passed in: its wallpaper path points at the copy.