update theme
This commit is contained in:
@@ -162,7 +162,11 @@ impl Brand {
|
||||
/// The shipped palette for an appearance, rotated onto this brand.
|
||||
pub fn branded(&self, appearance: ThemeMode) -> ThemeColors {
|
||||
let mut colors = ThemeColors::for_appearance(appearance);
|
||||
self.apply(appearance, &mut colors);
|
||||
// apply() re-asserts this brand's ink, so the default brand — whose
|
||||
// ink is the shipped one — must skip it to stay a strict no-op.
|
||||
if !self.is_default() {
|
||||
self.apply(appearance, &mut colors);
|
||||
}
|
||||
colors
|
||||
}
|
||||
|
||||
|
||||
@@ -398,10 +398,12 @@ impl ThemeColors {
|
||||
self.danger_disabled = wash_for(appearance, 0.06);
|
||||
|
||||
// Warning
|
||||
self.warning_foreground = self.text;
|
||||
// warning_muted is a translucent amber wash, so its ink is the amber
|
||||
// token itself, and its state washes deepen the plate.
|
||||
self.warning_foreground = self.warning;
|
||||
self.warning_background = self.warning_muted;
|
||||
self.warning_hover = self.element_hover;
|
||||
self.warning_active = self.element_active;
|
||||
self.warning_hover = plate_hover_for(appearance, self.warning_muted);
|
||||
self.warning_active = plate_active_for(appearance, self.warning_muted);
|
||||
self.warning_selected = self.element_active;
|
||||
self.warning_disabled = wash_for(appearance, 0.06);
|
||||
|
||||
@@ -417,7 +419,7 @@ impl ThemeColors {
|
||||
self.tab_background = self.surface;
|
||||
self.tab_foreground = self.text_muted;
|
||||
self.tab_hover_background = self.element_hover;
|
||||
self.tab_active_background = self.bg;
|
||||
self.tab_active_background = self.element_active;
|
||||
self.tab_active_foreground = self.text;
|
||||
|
||||
// Scrollbar
|
||||
|
||||
@@ -163,7 +163,9 @@ pub fn sync_base(cx: &mut App) {
|
||||
tokens.accent = colors.element_hover;
|
||||
tokens.accent_foreground = colors.text;
|
||||
tokens.destructive = colors.danger_strong;
|
||||
tokens.destructive_foreground = colors.on_accent;
|
||||
// Bezel's destructive pairing: white ink on the red plate in both
|
||||
// appearances.
|
||||
tokens.destructive_foreground = gpui::white();
|
||||
tokens.border = colors.border;
|
||||
tokens.input = colors.border;
|
||||
tokens.ring = colors.ring;
|
||||
|
||||
@@ -53,7 +53,6 @@ pub(crate) fn dark() -> ThemeColors {
|
||||
danger_muted: color::oklch(0.808, 0.114, 19.571), // red-300
|
||||
danger_strong: color::oklch(0.58, 0.16, 25.0),
|
||||
warning: color::oklch(0.828, 0.189, 84.429), // amber-400
|
||||
warning_muted: color::oklch(0.924, 0.12, 95.746), // amber-200
|
||||
success: color::oklch(0.765, 0.177, 163.223), // emerald-400
|
||||
success_muted: color::oklch(0.845, 0.143, 164.978), // emerald-300
|
||||
busy: color::oklch(0.718, 0.202, 349.761), // pink-400
|
||||
@@ -83,6 +82,9 @@ pub(crate) fn dark() -> ThemeColors {
|
||||
|
||||
..ThemeColors::legacy_default()
|
||||
};
|
||||
// Same warning-chip rule as light: a translucent amber wash under the
|
||||
// `warning` token, not an opaque plate.
|
||||
colors.warning_muted = colors.warning.alpha(0.16);
|
||||
colors.sync_legacy(ThemeMode::Dark);
|
||||
colors
|
||||
}
|
||||
@@ -119,7 +121,9 @@ pub(crate) fn light() -> ThemeColors {
|
||||
|
||||
// ---- text ----
|
||||
text: TextInk::color(ThemeMode::Light, Ink::APPKIT.light.text),
|
||||
text_muted: TextInk::color(ThemeMode::Light, Ink::APPKIT.light.muted),
|
||||
// One rung darker than AppKit's secondary label: sidebar and list
|
||||
// labels sit on the chrome grey and need ~5:1, not the system ~4:1.
|
||||
text_muted: color::neutral(0.45),
|
||||
text_faint: TextInk::color(ThemeMode::Light, Ink::APPKIT.light.faint),
|
||||
text_dim: color::neutral(0.50),
|
||||
|
||||
@@ -137,7 +141,6 @@ pub(crate) fn light() -> ThemeColors {
|
||||
danger_muted: color::oklch(0.505, 0.213, 27.518), // red-700
|
||||
danger_strong: color::oklch(0.51, 0.20, 25.0),
|
||||
warning: color::oklch(0.555, 0.163, 48.998), // amber-700 — carries 12px text
|
||||
warning_muted: color::oklch(0.473, 0.137, 46.201), // amber-800
|
||||
success: color::oklch(0.596, 0.145, 163.225), // emerald-600
|
||||
success_muted: color::oklch(0.508, 0.118, 165.612), // emerald-700
|
||||
busy: color::oklch(0.592, 0.249, 0.584), // pink-600
|
||||
@@ -147,7 +150,9 @@ pub(crate) fn light() -> ThemeColors {
|
||||
// "brighten the plate, don't wash it out" rule, read the other way.
|
||||
surface_raised_hover: color::neutral(0.900),
|
||||
band: band_for(ThemeMode::Light),
|
||||
input_bg: color::grey(0xff),
|
||||
// Inputs read as one rung below the chrome grey — the old scale's
|
||||
// step-3 input plate. Pure white vanished against the content plane.
|
||||
input_bg: color::neutral(0.950),
|
||||
selection: rgb(0xb3d7ff).into(),
|
||||
cursor: color::neutral(0.205),
|
||||
caret: color::neutral(0.511),
|
||||
@@ -169,6 +174,10 @@ pub(crate) fn light() -> ThemeColors {
|
||||
|
||||
..ThemeColors::legacy_default()
|
||||
};
|
||||
// The warning chip is a translucent amber wash, not an opaque plate: the
|
||||
// 700-800 amber reads as muddy brown, and a wash lets the label ride on
|
||||
// the `warning` token in both appearances.
|
||||
colors.warning_muted = colors.warning.alpha(0.10);
|
||||
colors.sync_legacy(ThemeMode::Light);
|
||||
colors
|
||||
}
|
||||
|
||||
@@ -109,6 +109,21 @@ fn brand_tint_rotates_greys_and_keeps_semantics() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn warning_wash_carries_its_label() {
|
||||
// warning_muted is a translucent amber wash, so the label pairing is
|
||||
// measured against the plate flattened onto the content plane.
|
||||
for appearance in [ThemeMode::Dark, ThemeMode::Light] {
|
||||
let colors = ThemeColors::for_appearance(appearance);
|
||||
let plate = flatten(colors.warning_muted, colors.bg);
|
||||
assert!(
|
||||
ratio(colors.warning, plate) >= 3.0,
|
||||
"{appearance:?}: warning on warning_muted = {}",
|
||||
ratio(colors.warning, plate)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_aliases_track_tokens() {
|
||||
for appearance in [ThemeMode::Dark, ThemeMode::Light] {
|
||||
@@ -118,7 +133,7 @@ fn legacy_aliases_track_tokens() {
|
||||
assert_eq!(colors.text_placeholder, colors.text_faint);
|
||||
assert_eq!(colors.element_background, colors.solid);
|
||||
assert_eq!(colors.secondary_background, colors.surface_raised);
|
||||
assert_eq!(colors.tab_active_background, colors.bg);
|
||||
assert_eq!(colors.tab_active_background, colors.element_active);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user