mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-21 16:02:20 +00:00
style(theme): drop the lift under every inline control
Theme::shadow gates exactly one thing -- the shadow_xs an inline control (button, input, select trigger, checkbox, radio, slider knob) paints under itself -- and never the drop shadow on a menu, tooltip or popover, which each draw theirs unconditionally. Left on, every field and button in the window carried a faint lift that nothing else here has: this chrome separates surfaces with low-contrast fills and hairlines, so a control sitting a millimetre above the panel was the one place claiming depth. Panels that really do float keep their shadow. Also bumps the gpui-component pin, and records why the switch and slider keep their accent: both were tried on the neutral ramp the segmented controls use, and a dark-grey "on" against a light-grey "off" turned out not to be a large enough step to read while scanning a column of rows.
This commit is contained in:
Generated
+3
-3
@@ -3353,7 +3353,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gpui-component"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/l0ng-ai/gpui-component?branch=tty7#070d1a28cec5130bf7c4c7895683595d488155b8"
|
||||
source = "git+https://github.com/l0ng-ai/gpui-component?branch=tty7#51a6925955adda598c9363915a06eae6de5dd8df"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"anyhow",
|
||||
@@ -3436,7 +3436,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gpui-component-assets"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/l0ng-ai/gpui-component?branch=tty7#070d1a28cec5130bf7c4c7895683595d488155b8"
|
||||
source = "git+https://github.com/l0ng-ai/gpui-component?branch=tty7#51a6925955adda598c9363915a06eae6de5dd8df"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"gpui",
|
||||
@@ -3450,7 +3450,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gpui-component-macros"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/l0ng-ai/gpui-component?branch=tty7#070d1a28cec5130bf7c4c7895683595d488155b8"
|
||||
source = "git+https://github.com/l0ng-ai/gpui-component?branch=tty7#51a6925955adda598c9363915a06eae6de5dd8df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -780,6 +780,16 @@ pub(crate) fn apply_theme(mut window: Option<&mut Window>, cx: &mut App) {
|
||||
// give primary buttons, and the thumb to `primary_foreground`, which on a
|
||||
// dark theme is a black disc on a dark page. Side by side on one settings
|
||||
// page the two controls disagreed about what a set value looks like.
|
||||
//
|
||||
// Both were tried on `primary` — the neutral ramp the segmented controls
|
||||
// and the sidebar's selected page are drawn from — to settle a complaint
|
||||
// that the accent pills were the only saturated things on a screen of
|
||||
// greys. Reverted on sight: a dark-grey "on" against a light-grey "off" is
|
||||
// not a large enough step to read at a glance down a column of rows, and a
|
||||
// switch whose state you have to look twice at has lost the one job it has.
|
||||
// If the mismatch with the segmented controls is worth closing, it has to
|
||||
// close from the other end — by giving *them* some accent — not by taking
|
||||
// it away from here.
|
||||
t.tokens.slider_bar = Hsla::from(rgb(m.accent)).into();
|
||||
t.tokens.slider_thumb = Hsla::from(rgb(knob)).into();
|
||||
|
||||
@@ -806,6 +816,18 @@ pub(crate) fn apply_theme(mut window: Option<&mut Window>, cx: &mut App) {
|
||||
|
||||
t.radius = px(8.);
|
||||
|
||||
// Flat controls, floating panels. `Theme::shadow` gates exactly one thing —
|
||||
// the `shadow_xs` an inline control (button, input, select trigger,
|
||||
// checkbox, radio, slider knob) paints under itself — and never the drop
|
||||
// shadow on a menu, tooltip or popover, which every one of those draws
|
||||
// unconditionally. Left on, every field and button in the window carried a
|
||||
// faint lift that nothing else here has: this chrome separates surfaces with
|
||||
// low-contrast fills and hairlines, so a control sitting a millimetre above
|
||||
// the panel was the one place claiming depth, and it read as a rendering
|
||||
// artefact rather than as a material. Panels that really do float keep
|
||||
// their shadow.
|
||||
t.shadow = false;
|
||||
|
||||
let sidebar_bg = Hsla::from(rgb(m.sidebar));
|
||||
let sidebar_sel = rgb(surfaces.sidebar.selected);
|
||||
// `t.sidebar` stays the opaque theme token: the settings theme picker
|
||||
@@ -881,6 +903,14 @@ pub(crate) fn apply_theme(mut window: Option<&mut Window>, cx: &mut App) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Every switch in the window, built here so the on-state has one definition.
|
||||
///
|
||||
/// The accent is load-bearing, not decoration. Without `.color()` a switch's
|
||||
/// on-state falls to `tokens.primary`, a dark neutral, and against the light
|
||||
/// neutral of the off-state that is too small a step to read while scanning a
|
||||
/// column of rows — you end up checking the thumb's position on each one. It
|
||||
/// was tried that way and reverted; see the slider-bar note in `apply_theme`
|
||||
/// for the other half of the pair.
|
||||
pub(crate) fn switch(id: impl Into<gpui::ElementId>, cx: &App) -> gpui_component::switch::Switch {
|
||||
let accent = cx.global::<presets::ActiveAccent>().0;
|
||||
gpui_component::switch::Switch::new(id).color(Hsla::from(rgb(accent)))
|
||||
|
||||
Reference in New Issue
Block a user