Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run
18 lines
684 B
Rust
18 lines
684 B
Rust
use gpui::App;
|
|
use gpui_native_kit::theme::{ThemeVariant, follow_system, set_mode_override};
|
|
use settings::{AppearanceMode, Settings};
|
|
|
|
/// Applies the persisted light/dark/system preference to the kit theme.
|
|
pub fn apply_appearance(settings: &Settings, cx: &mut App) {
|
|
apply_appearance_mode(settings.appearance, cx);
|
|
}
|
|
|
|
/// Applies one appearance mode to the kit theme.
|
|
pub fn apply_appearance_mode(mode: AppearanceMode, cx: &mut App) {
|
|
match mode {
|
|
AppearanceMode::System => follow_system(cx),
|
|
AppearanceMode::Light => set_mode_override(Some(ThemeVariant::Light), cx),
|
|
AppearanceMode::Dark => set_mode_override(Some(ThemeVariant::Dark), cx),
|
|
}
|
|
}
|