sidebar: fall back to theme sidebar color when opaque
This commit is contained in:
@@ -21,6 +21,8 @@ pub struct ColorTokens {
|
||||
pub foreground: Hsla,
|
||||
pub surface: Hsla,
|
||||
pub surface_foreground: Hsla,
|
||||
/// The docked sidebar's backdrop, matching the platform's window chrome.
|
||||
pub sidebar: Hsla,
|
||||
pub primary: Hsla,
|
||||
pub primary_foreground: Hsla,
|
||||
pub secondary: Hsla,
|
||||
@@ -56,6 +58,7 @@ impl ColorTokens {
|
||||
foreground: hex(0x18181b),
|
||||
surface: hex(0xfafafa),
|
||||
surface_foreground: hex(0x18181b),
|
||||
sidebar: hex(0xf4f4f5),
|
||||
primary: hex(0x2563eb),
|
||||
primary_foreground: hex(0xffffff),
|
||||
secondary: hex(0xf4f4f5),
|
||||
@@ -90,6 +93,7 @@ impl ColorTokens {
|
||||
foreground: hex(0xfafafa),
|
||||
surface: hex(0x18181b),
|
||||
surface_foreground: hex(0xfafafa),
|
||||
sidebar: hex(0x18181b),
|
||||
primary: hex(0x3b82f6),
|
||||
primary_foreground: hex(0xffffff),
|
||||
secondary: hex(0x27272a),
|
||||
|
||||
@@ -19,6 +19,7 @@ pub struct ThemeDefinition {
|
||||
foreground: Option<String>,
|
||||
surface: Option<String>,
|
||||
surface_foreground: Option<String>,
|
||||
sidebar: Option<String>,
|
||||
primary: Option<String>,
|
||||
primary_foreground: Option<String>,
|
||||
secondary: Option<String>,
|
||||
@@ -87,6 +88,10 @@ impl ThemeDefinition {
|
||||
self.color(&self.surface_foreground, "surface_foreground")
|
||||
}
|
||||
|
||||
pub fn sidebar(&self) -> Option<Hsla> {
|
||||
self.color(&self.sidebar, "sidebar")
|
||||
}
|
||||
|
||||
pub fn primary(&self) -> Option<Hsla> {
|
||||
self.color(&self.primary, "primary")
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@ pub(crate) fn resolve(
|
||||
system_palette.surface_foreground,
|
||||
base.surface_foreground,
|
||||
),
|
||||
sidebar: pick(
|
||||
def_color(|d| d.sidebar()),
|
||||
system_palette.sidebar,
|
||||
base.sidebar,
|
||||
),
|
||||
primary,
|
||||
primary_foreground: pick(
|
||||
def_color(|d| d.primary_foreground()),
|
||||
|
||||
@@ -86,6 +86,7 @@ impl MacosSource {
|
||||
foreground: Self::color_to_hsla(&NSColor::labelColor()),
|
||||
surface: Self::color_to_hsla(&NSColor::textBackgroundColor()),
|
||||
surface_foreground: Self::color_to_hsla(&NSColor::labelColor()),
|
||||
sidebar: Self::color_to_hsla(&NSColor::windowBackgroundColor()),
|
||||
primary_foreground: Self::color_to_hsla(&NSColor::alternateSelectedControlTextColor()),
|
||||
accent_foreground: Self::color_to_hsla(&NSColor::alternateSelectedControlTextColor()),
|
||||
secondary: None,
|
||||
|
||||
@@ -63,6 +63,8 @@ pub struct PartialPalette {
|
||||
pub foreground: Option<Hsla>,
|
||||
pub surface: Option<Hsla>,
|
||||
pub surface_foreground: Option<Hsla>,
|
||||
/// Only macOS states it, the window backdrop its sidebars show.
|
||||
pub sidebar: Option<Hsla>,
|
||||
pub primary_foreground: Option<Hsla>,
|
||||
pub accent_foreground: Option<Hsla>,
|
||||
pub secondary: Option<Hsla>,
|
||||
|
||||
Reference in New Issue
Block a user