mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-21 16:02:20 +00:00
fix(ui): let the overlay scrollbars fade out again (#471)
* fix(search): wash a match in the accent, at a strength the theme can afford A search hit was washed from the terminal palette's selection colour at a fixed 1.45:1 against the background, so it read as a weaker selection on a grid that is already grey on grey — and 1.45:1 is under what a hairline is worth, spread over a whole cell. Two changes. The tint is now the theme's accent (`ActiveAccent`, already floored at 3:1 by `legible_accent`), which is the one colour the terminal surface has nothing else in. And the strength is derived per theme instead of fixed: the wash is opaque with the glyph drawn on top, so what it may spend is the theme's own text-contrast budget. A palette with 21:1 between text and background can afford a wash you cannot miss; one with 6.6:1 cannot, and a single constant has to be safe for the second. The current match drops its caret-coloured outline. That existed because a fill 2.1:1 off the background could not say "this one" on its own; now that it sits at the top of the theme's budget, the outline is the same colour saying the same thing twice. * fix(ui): let the overlay scrollbars fade out again macOS reports should_auto_hide_scrollbars() = false for anyone with a mouse plugged in, and apply_theme turned that into ScrollbarShow::Always for every list in the app. That preference is about legacy scrollbars, which take a gutter out of the layout; ours are overlay bars painted on top of the content, so Always parked an opaque bar over the switcher's tab column for as long as the panel stayed open, with nothing to fade it. Pin scrollbar_show to Scrolling instead, so every list fades its bar out after it stops scrolling. --------- Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
This commit is contained in:
+3
-4
@@ -33,10 +33,9 @@ pub(crate) fn with_vertical_scrollbar(
|
||||
.right_0()
|
||||
.bottom_0()
|
||||
// No `scrollbar_show` override: it falls back to
|
||||
// `cx.theme().scrollbar_show`, which `apply_theme` derives from
|
||||
// `should_auto_hide_scrollbars()` — the OS "show scroll bars"
|
||||
// preference. Pinning it here would take that choice away from
|
||||
// everyone who asked for always-visible bars.
|
||||
// `cx.theme().scrollbar_show`, which `apply_theme` pins to
|
||||
// `Scrolling` for every list in the app. Overriding it here
|
||||
// would be one list disagreeing with the rest.
|
||||
.child(Scrollbar::vertical(handle).id(id)),
|
||||
)
|
||||
.into_any_element()
|
||||
|
||||
+8
-6
@@ -578,7 +578,6 @@ pub(crate) fn apply_theme(mut window: Option<&mut Window>, cx: &mut App) {
|
||||
let surfaces = theme.surfaces();
|
||||
let sem = theme.semantics();
|
||||
let active = theme.active_palette(config.theme_legible_palette);
|
||||
let auto_hide_scrollbars = cx.should_auto_hide_scrollbars();
|
||||
|
||||
let backdrop = config.window_backdrop;
|
||||
|
||||
@@ -769,11 +768,14 @@ pub(crate) fn apply_theme(mut window: Option<&mut Window>, cx: &mut App) {
|
||||
t.tokens.scrollbar_thumb = scrollbar_thumb.into();
|
||||
t.tokens.scrollbar_thumb_hover = scrollbar_thumb_hover.into();
|
||||
|
||||
t.scrollbar_show = if auto_hide_scrollbars {
|
||||
ScrollbarShow::Scrolling
|
||||
} else {
|
||||
ScrollbarShow::Always
|
||||
};
|
||||
// Not `should_auto_hide_scrollbars()`. That preference answers a question
|
||||
// about *legacy* scrollbars — the ones that take a gutter out of the layout
|
||||
// — and macOS says "don't hide them" for anyone with a mouse plugged in.
|
||||
// Ours are overlay bars painted on top of the content, so honouring it
|
||||
// parked an opaque bar over the switcher's tab column for the whole time
|
||||
// the panel was open, with nothing to fade it out. Every list in the app
|
||||
// gets the same bar, so it fades everywhere or nowhere.
|
||||
t.scrollbar_show = ScrollbarShow::Scrolling;
|
||||
|
||||
t.radius = px(8.);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user