Expand description
Native OS theme discovery: system colors, fonts, and DPI. Discovers system-native styling for colors, fonts, and other metrics.
This module provides a best-effort attempt to query the host operating system
for its UI theme information. This is gated behind the io feature flag.
End-user customization (AZ_RICING):
By default (if the io feature is enabled), Azul looks for an
application-specific stylesheet at ~/.config/azul/styles/<app_name>.css
(or %APPDATA%\azul\styles\<app_name>.css on Windows) and applies it as
the last layer of the cascade, letting end-users “rice” any Azul app.
The AZ_RICING env var has three modes (case-insensitive):
- unset (default): load the user CSS if present; on Linux, the
detection chain is
KDE > GNOME > riced > defaults. AZ_RICING=off(aliases:disabled,none,0): skip the user CSS file and the riced-desktop sources (Hyprland config, pywal cache). Use for kiosk builds or CI runs that mustn’t pick up local customization.AZ_RICING=force(aliases:prefer,aggressive,1): on Linux, reorder the detection chain so riced-desktop sources win over GNOME/KDE — useful for tiling-WM users whoseXDG_CURRENT_DESKTOPstill saysgnome. The user CSS file still loads.
Modules§
- apple_
fonts - Apple system font family names for font fallback chains.
- defaults
- A collection of hard-coded system style defaults that mimic the appearance of various operating systems and desktop environments. These are used as a fallback when the “io” feature is disabled, ensuring deterministic styles for testing and environments where system calls are not desired.
- linux_
fonts - Linux/GTK common font family names.
- windows_
fonts - Windows system font family names.
Structs§
- Accessibility
Settings - Accessibility settings detected from the operating system.
- Animation
Metrics - Animation-related preferences from the OS.
- Audio
Metrics - Audio-feedback preferences from the OS.
- Focus
Visuals - Focus ring / indicator visual style.
- Icon
Style Options - Icon-specific styling options for accessibility and theming.
- Input
Metrics - Input interaction timing and distance thresholds from the OS.
- Linux
Customization - Linux-specific customisation settings.
- Safe
Area Insets - Safe area insets for devices with notches, rounded corners, or sensor housings.
- Scrollbar
Preferences - OS-level scrollbar behaviour preferences.
- System
Colors - Common system colors used for UI elements.
- System
Fonts - Common system font settings.
- System
Metrics - Common system metrics for UI element sizing and spacing.
- System
Style - A unified collection of discovered system style properties.
- Text
Rendering Hints - Text rendering configuration from the OS.
- Titlebar
Buttons - Which window control buttons are available in the titlebar.
- Titlebar
Metrics - Metrics for titlebar layout and window chrome.
- Visual
Hints - Visual hints from the OS about how icons and decorations should be shown.
Enums§
- Desktop
Environment - Represents the detected Linux Desktop Environment.
- Focus
Behavior - Focus indicator behaviour (always visible vs keyboard-only).
- Platform
- Represents the detected platform.
- Ricing
Mode - User-customization mode controlled by the
AZ_RICINGenv var. - Scrollbar
Track Click - What happens when clicking the scrollbar track area.
- Scrollbar
Visibility - When scrollbars should be shown (OS-level preference).
- Subpixel
Type - Subpixel rendering layout for font smoothing.
- System
Font Type - System font types that can be resolved at runtime based on OS settings.
- Theme
- The overall theme type.
- Titlebar
Button Side - Which side of the titlebar the window control buttons are on.
- Toolbar
Style - Toolbar display style (icons, text, or both).
Functions§
- detect_
linux_ desktop_ env - Detect the Linux desktop environment from environment variables.
- detect_
system_ language - Detect the system language as a BCP 47 tag.
- ricing_
enabled - True when the user CSS file at
~/.config/azul/styles/<app>.cssshould be read. False only whenAZ_RICING=offis set. - ricing_
mode - Read the
AZ_RICINGenv var and classify it. Case-insensitive. Anything we don’t recognise falls through toDefaultso a typo degrades gracefully instead of disabling the feature silently.