Rename 'cycle theme mode' to 'toggle theme mode' and toggle only between light and dark

This commit is contained in:
Eduardo Alba 2025-08-12 19:09:29 -04:00
parent 427f799018
commit e9c2796034
3 changed files with 15 additions and 9 deletions

View file

@ -40,9 +40,9 @@ pub fn init(cx: &mut App) {
toggle_icon_theme_selector(workspace, &action, window, cx);
});
});
cx.on_action(|_: &zed_actions::theme_selector::CycleMode, cx| {
cx.on_action(|_: &zed_actions::theme_selector::ToggleMode, cx| {
with_active_or_new_workspace(cx, |workspace, window, cx| {
cycle_theme_mode(workspace, window, cx);
toggle_theme_mode(workspace, window, cx);
});
});
}
@ -83,15 +83,21 @@ fn toggle_icon_theme_selector(
});
}
fn cycle_theme_mode(workspace: &mut Workspace, _window: &mut Window, cx: &mut Context<Workspace>) {
fn toggle_theme_mode(workspace: &mut Workspace, _window: &mut Window, cx: &mut Context<Workspace>) {
let current_settings = ThemeSettings::get_global(cx);
let current_selection = current_settings.theme_selection.as_ref();
let new_mode = match current_selection {
Some(ThemeSelection::Dynamic { mode, .. }) => match mode {
ThemeMode::Light => ThemeMode::Dark,
ThemeMode::Dark => ThemeMode::System,
ThemeMode::System => ThemeMode::Light,
ThemeMode::Dark => ThemeMode::Light,
ThemeMode::System => {
if cx.theme().appearance().is_light() {
ThemeMode::Dark
} else {
ThemeMode::Light
}
}
},
Some(ThemeSelection::Static(_)) => ThemeMode::Light,
None => ThemeMode::Light,

View file

@ -33,8 +33,8 @@ pub fn app_menus() -> Vec<Menu> {
zed_actions::theme_selector::Toggle::default(),
),
MenuItem::action(
"Cycle Theme Mode",
zed_actions::theme_selector::CycleMode,
"Toggle Theme Mode",
zed_actions::theme_selector::ToggleMode,
),
],
}),

View file

@ -244,11 +244,11 @@ pub mod theme_selector {
pub themes_filter: Option<Vec<String>>,
}
/// Cycles between light, dark, and system theme modes.
/// Toggles between light and dark theme modes.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = theme_selector)]
#[serde(deny_unknown_fields)]
pub struct CycleMode;
pub struct ToggleMode;
}
pub mod icon_theme_selector {