Use active color for zoom button in a zoomed pane

This commit is contained in:
Max Brunsfeld 2023-05-31 12:51:57 -07:00
parent 893615236d
commit 3f6aa94a5f
3 changed files with 10 additions and 5 deletions

View file

@ -70,6 +70,7 @@ impl TerminalPanel {
.with_child(Pane::render_tab_bar_button( .with_child(Pane::render_tab_bar_button(
0, 0,
"icons/plus_12.svg", "icons/plus_12.svg",
false,
Some(( Some((
"New Terminal".into(), "New Terminal".into(),
Some(Box::new(workspace::NewTerminal)), Some(Box::new(workspace::NewTerminal)),
@ -94,6 +95,7 @@ impl TerminalPanel {
} else { } else {
"icons/maximize_8.svg" "icons/maximize_8.svg"
}, },
pane.is_zoomed(),
Some(("Toggle Zoom".into(), Some(Box::new(workspace::ToggleZoom)))), Some(("Toggle Zoom".into(), Some(Box::new(workspace::ToggleZoom)))),
cx, cx,
move |pane, cx| pane.toggle_zoom(&Default::default(), cx), move |pane, cx| pane.toggle_zoom(&Default::default(), cx),

View file

@ -268,6 +268,7 @@ impl Pane {
.with_child(Self::render_tab_bar_button( .with_child(Self::render_tab_bar_button(
0, 0,
"icons/plus_12.svg", "icons/plus_12.svg",
false,
Some(("New...".into(), None)), Some(("New...".into(), None)),
cx, cx,
|pane, cx| pane.deploy_new_menu(cx), |pane, cx| pane.deploy_new_menu(cx),
@ -277,6 +278,7 @@ impl Pane {
.with_child(Self::render_tab_bar_button( .with_child(Self::render_tab_bar_button(
1, 1,
"icons/split_12.svg", "icons/split_12.svg",
false,
Some(("Split Pane".into(), None)), Some(("Split Pane".into(), None)),
cx, cx,
|pane, cx| pane.deploy_split_menu(cx), |pane, cx| pane.deploy_split_menu(cx),
@ -290,6 +292,7 @@ impl Pane {
} else { } else {
"icons/maximize_8.svg" "icons/maximize_8.svg"
}, },
pane.is_zoomed(),
Some(("Toggle Zoom".into(), Some(Box::new(ToggleZoom)))), Some(("Toggle Zoom".into(), Some(Box::new(ToggleZoom)))),
cx, cx,
move |pane, cx| pane.toggle_zoom(&Default::default(), cx), move |pane, cx| pane.toggle_zoom(&Default::default(), cx),
@ -1401,6 +1404,7 @@ impl Pane {
pub fn render_tab_bar_button<F: 'static + Fn(&mut Pane, &mut EventContext<Pane>)>( pub fn render_tab_bar_button<F: 'static + Fn(&mut Pane, &mut EventContext<Pane>)>(
index: usize, index: usize,
icon: &'static str, icon: &'static str,
active: bool,
tooltip: Option<(String, Option<Box<dyn Action>>)>, tooltip: Option<(String, Option<Box<dyn Action>>)>,
cx: &mut ViewContext<Pane>, cx: &mut ViewContext<Pane>,
on_click: F, on_click: F,
@ -1410,7 +1414,7 @@ impl Pane {
let mut button = MouseEventHandler::<TabBarButton, _>::new(index, cx, |mouse_state, cx| { let mut button = MouseEventHandler::<TabBarButton, _>::new(index, cx, |mouse_state, cx| {
let theme = &settings::get::<ThemeSettings>(cx).theme.workspace.tab_bar; let theme = &settings::get::<ThemeSettings>(cx).theme.workspace.tab_bar;
let style = theme.pane_button.style_for(mouse_state, false); let style = theme.pane_button.style_for(mouse_state, active);
Svg::new(icon) Svg::new(icon)
.with_color(style.color) .with_color(style.color)
.constrained() .constrained()

View file

@ -31,10 +31,6 @@ export default function tabBar(colorScheme: ColorScheme) {
iconClose: foreground(layer, "variant"), iconClose: foreground(layer, "variant"),
iconCloseActive: foreground(layer, "hovered"), iconCloseActive: foreground(layer, "hovered"),
// Zoom Icons
iconZoom: foreground(layer, "variant"),
iconZoomActive: foreground(layer, "accent"),
// Indicators // Indicators
iconConflict: foreground(layer, "warning"), iconConflict: foreground(layer, "warning"),
iconDirty: foreground(layer, "accent"), iconDirty: foreground(layer, "accent"),
@ -98,6 +94,9 @@ export default function tabBar(colorScheme: ColorScheme) {
hover: { hover: {
color: foreground(layer, "hovered"), color: foreground(layer, "hovered"),
}, },
active: {
color: foreground(layer, "accent"),
}
}, },
paneButtonContainer: { paneButtonContainer: {
background: tab.background, background: tab.background,