T19: the main window lets the desktop through while Background opacity is under 1, blurred or clear as Background blur says, set at open and as the settings change; Ely's new ColumnShell::glass grounds every column and the title bar in the palette's glass, which the opacity sets, and the Ely pin moves to it past 27 of Ely's own commits; dialogs stay solid; the terminal paints no second ground; shot names the window's AppKit views
CI / platforms (windows-latest) (push) Failing after 8s
CI / macos (push) Failing after 8m32s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-14 23:27:19 -04:00
1 parent d0162ef009
commit c98bbad6e0
11 files changed
+137 -28

No files matched your search

+17 -12
View File
@@ -4,20 +4,23 @@ use gpui::App;
use super::{TerminalTheme, active};
use crate::settings::SettingsStore;
/// The chrome's palette for a terminal theme; none for Ely's own, which Ely draws.
pub fn palette(theme: &TerminalTheme) -> Option<Palette> {
if theme.ely {
return None;
}
let (bg, fg, ansi) = (theme.background, theme.foreground, theme.ansi);
/// The chrome's palette for a terminal theme, its glass as see-through as the background; Ely's own keep Ely's colors.
pub fn palette(theme: &TerminalTheme, opacity: f32) -> Palette {
let base = if theme.is_dark() {
Palette::dark(false)
} else {
Palette::light(false)
};
if theme.ely {
return Palette {
glass: base.bg.alpha(opacity),
..base
};
}
let (bg, fg, ansi) = (theme.background, theme.foreground, theme.ansi);
let tint = |share: f32| bg.mix(&fg, share);
let wash = |color: gpui::Hsla| bg.mix(&color, 0.18);
Some(Palette {
Palette {
bg,
surface: bg,
sunken: tint(0.03),
@@ -44,7 +47,7 @@ pub fn palette(theme: &TerminalTheme) -> Option<Palette> {
warning_subtle: wash(ansi[3]),
danger_subtle: wash(ansi[1]),
info_subtle: wash(ansi[4]),
glass: bg.alpha(base.glass.a),
glass: bg.alpha(opacity),
tooltip_bg: tint(0.2),
tooltip_fg: fg,
chart: [
@@ -67,18 +70,20 @@ pub fn palette(theme: &TerminalTheme) -> Option<Palette> {
variable: fg,
},
..base
})
}
}
/// Dresses the app in the theme the settings choose for the system's appearance.
pub fn apply(cx: &mut App) {
let theme = active(SettingsStore::get(cx), cx.window_appearance());
let settings = SettingsStore::get(cx);
let theme = active(settings, cx.window_appearance());
let opacity = settings.background_opacity;
let mode = if theme.is_dark() {
Mode::Dark
} else {
Mode::Light
};
Theme::set_palette(mode, palette(theme), cx);
Theme::set_palette(mode, Some(palette(theme, opacity)), cx);
Theme::set_mode_now(mode, cx);
log::info!("theme: {} in {mode:?}", theme.id);
log::info!("theme: {} in {mode:?}, glass at {opacity}", theme.id);
}
+17 -3
View File
@@ -114,11 +114,25 @@ fn the_dark_theme_wins_only_in_dark_mode() {
#[test]
fn the_chrome_wears_the_theme() {
let dracula = find("dracula").expect("dracula");
let chrome = palette(dracula).expect("a mapped palette");
let chrome = palette(dracula, 1.0);
assert_eq!(chrome.bg, dracula.background);
assert_eq!(chrome.fg, dracula.foreground);
assert_eq!(chrome.ansi, dracula.ansi);
assert_eq!(chrome.danger, dracula.ansi[1]);
assert!(chrome.glass.a < 1.0);
assert!(palette(find("ely-dark").expect("ely")).is_none());
let ely = palette(find("ely-dark").expect("ely"), 1.0);
assert_eq!(ely.bg, Palette::dark(false).bg, "Ely's own colors");
}
#[test]
fn the_glass_lets_through_what_the_opacity_leaves() {
for id in ["dracula", "ely-light"] {
let theme = find(id).expect("a theme");
let chrome = palette(theme, 0.4);
assert_eq!(chrome.glass, chrome.bg.alpha(0.4), "{id}");
assert_eq!(
chrome.bg.a, 1.0,
"{id}: the ground under dialogs stays solid"
);
assert_eq!(palette(theme, 1.0).glass, chrome.bg, "{id}");
}
}