Skip to main content

from_system

Function from_system 

Source
pub fn from_system() -> Result<(Theme, ResolvedThemeVariant)>
Expand description

Detect the OS theme and convert it to a gpui-component Theme in one call.

Combines SystemTheme::from_system() with to_theme() using the system-detected name and dark-mode preference.

Returns both the gpui Theme and the ResolvedThemeVariant so callers can access per-widget metrics that the flat ThemeColor cannot represent.

§Errors

Returns an error if the platform theme cannot be read (e.g., unsupported platform, missing desktop environment).

§Examples

let (theme, resolved) = native_theme_gpui::from_system()?;