theme: Rename Colors to ThemeColor and public it. (#395)
This commit is contained in:
parent
26211000f7
commit
3508453b11
1 changed files with 260 additions and 187 deletions
|
|
@ -140,130 +140,204 @@ impl Colorize for Hsla {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[derive(Debug, Clone, Copy, Default)]
|
||||||
#[derive(Debug, Clone, Copy)]
|
pub struct ThemeColor {
|
||||||
struct Colors {
|
pub accent: Hsla,
|
||||||
pub title_bar: Hsla,
|
pub accent_foreground: Hsla,
|
||||||
pub title_bar_border: Hsla,
|
pub accordion: Hsla,
|
||||||
|
pub accordion_active: Hsla,
|
||||||
|
pub accordion_hover: Hsla,
|
||||||
pub background: Hsla,
|
pub background: Hsla,
|
||||||
pub foreground: Hsla,
|
pub border: Hsla,
|
||||||
pub card: Hsla,
|
pub card: Hsla,
|
||||||
pub card_foreground: Hsla,
|
pub card_foreground: Hsla,
|
||||||
|
pub destructive: Hsla,
|
||||||
|
pub destructive_active: Hsla,
|
||||||
|
pub destructive_foreground: Hsla,
|
||||||
|
pub destructive_hover: Hsla,
|
||||||
|
pub drag_border: Hsla,
|
||||||
|
pub drop_target: Hsla,
|
||||||
|
pub foreground: Hsla,
|
||||||
|
pub input: Hsla,
|
||||||
|
pub link: Hsla,
|
||||||
|
pub link_active: Hsla,
|
||||||
|
pub link_hover: Hsla,
|
||||||
|
pub list: Hsla,
|
||||||
|
pub list_active: Hsla,
|
||||||
|
pub list_active_border: Hsla,
|
||||||
|
pub list_even: Hsla,
|
||||||
|
pub list_head: Hsla,
|
||||||
|
pub list_hover: Hsla,
|
||||||
|
pub muted: Hsla,
|
||||||
|
pub muted_foreground: Hsla,
|
||||||
|
pub panel: Hsla,
|
||||||
pub popover: Hsla,
|
pub popover: Hsla,
|
||||||
pub popover_foreground: Hsla,
|
pub popover_foreground: Hsla,
|
||||||
pub primary: Hsla,
|
pub primary: Hsla,
|
||||||
pub primary_hover: Hsla,
|
|
||||||
pub primary_active: Hsla,
|
pub primary_active: Hsla,
|
||||||
pub primary_foreground: Hsla,
|
pub primary_foreground: Hsla,
|
||||||
pub secondary: Hsla,
|
pub primary_hover: Hsla,
|
||||||
pub secondary_hover: Hsla,
|
pub progress_bar: Hsla,
|
||||||
pub secondary_active: Hsla,
|
|
||||||
pub secondary_foreground: Hsla,
|
|
||||||
pub destructive: Hsla,
|
|
||||||
pub destructive_hover: Hsla,
|
|
||||||
pub destructive_active: Hsla,
|
|
||||||
pub destructive_foreground: Hsla,
|
|
||||||
pub muted: Hsla,
|
|
||||||
pub muted_foreground: Hsla,
|
|
||||||
pub accent: Hsla,
|
|
||||||
pub accent_foreground: Hsla,
|
|
||||||
pub border: Hsla,
|
|
||||||
pub input: Hsla,
|
|
||||||
pub ring: Hsla,
|
pub ring: Hsla,
|
||||||
pub selection: Hsla,
|
|
||||||
pub scrollbar: Hsla,
|
pub scrollbar: Hsla,
|
||||||
pub scrollbar_thumb: Hsla,
|
pub scrollbar_thumb: Hsla,
|
||||||
pub panel: Hsla,
|
pub secondary: Hsla,
|
||||||
|
pub secondary_active: Hsla,
|
||||||
|
pub secondary_foreground: Hsla,
|
||||||
|
pub secondary_hover: Hsla,
|
||||||
|
pub selection: Hsla,
|
||||||
|
pub skeleton: Hsla,
|
||||||
|
pub slider_bar: Hsla,
|
||||||
|
pub slider_thumb: Hsla,
|
||||||
|
pub tab: Hsla,
|
||||||
|
pub tab_active: Hsla,
|
||||||
|
pub tab_active_foreground: Hsla,
|
||||||
pub tab_bar: Hsla,
|
pub tab_bar: Hsla,
|
||||||
pub list: Hsla,
|
pub tab_foreground: Hsla,
|
||||||
pub list_even: Hsla,
|
pub table: Hsla,
|
||||||
pub list_head: Hsla,
|
pub table_active: Hsla,
|
||||||
pub link: Hsla,
|
pub table_active_border: Hsla,
|
||||||
pub drop_target: Hsla,
|
pub table_even: Hsla,
|
||||||
|
pub table_head: Hsla,
|
||||||
|
pub table_head_foreground: Hsla,
|
||||||
|
pub table_hover: Hsla,
|
||||||
|
pub table_row_border: Hsla,
|
||||||
|
pub title_bar: Hsla,
|
||||||
|
pub title_bar_border: Hsla,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Colors {
|
impl ThemeColor {
|
||||||
fn light() -> Colors {
|
pub fn light() -> Self {
|
||||||
Colors {
|
Self {
|
||||||
title_bar: hsl(0.0, 0.0, 100.),
|
accent: hsl(240.0, 5.0, 96.0),
|
||||||
title_bar_border: hsl(240.0, 5.9, 90.0),
|
accent_foreground: hsl(240.0, 5.9, 10.0),
|
||||||
|
accordion: hsl(0.0, 0.0, 100.0),
|
||||||
|
accordion_active: hsl(240.0, 5.9, 90.0),
|
||||||
|
accordion_hover: hsl(240.0, 4.8, 95.9).opacity(0.7),
|
||||||
background: hsl(0.0, 0.0, 100.),
|
background: hsl(0.0, 0.0, 100.),
|
||||||
foreground: hsl(240.0, 10., 3.9),
|
border: hsl(240.0, 5.9, 90.0),
|
||||||
card: hsl(0.0, 0.0, 100.0),
|
card: hsl(0.0, 0.0, 100.0),
|
||||||
card_foreground: hsl(240.0, 10.0, 3.9),
|
card_foreground: hsl(240.0, 10.0, 3.9),
|
||||||
|
destructive: hsl(0.0, 84.2, 60.2),
|
||||||
|
destructive_active: hsl(0.0, 84.2, 47.0),
|
||||||
|
destructive_foreground: hsl(0.0, 0.0, 98.0),
|
||||||
|
destructive_hover: hsl(0.0, 84.2, 65.0),
|
||||||
|
drag_border: crate::blue_500(),
|
||||||
|
drop_target: hsl(235.0, 30., 44.0).opacity(0.25),
|
||||||
|
foreground: hsl(240.0, 10., 3.9),
|
||||||
|
input: hsl(240.0, 5.9, 90.0),
|
||||||
|
link: hsl(221.0, 83.0, 53.0),
|
||||||
|
link_active: hsl(221.0, 83.0, 53.0).darken(0.2),
|
||||||
|
link_hover: hsl(221.0, 83.0, 53.0).lighten(0.2),
|
||||||
|
list: hsl(0.0, 0.0, 100.),
|
||||||
|
list_active: hsl(211.0, 97.0, 85.0).opacity(0.2),
|
||||||
|
list_active_border: hsl(211.0, 97.0, 85.0),
|
||||||
|
list_even: hsl(240.0, 5.0, 96.0),
|
||||||
|
list_head: hsl(0.0, 0.0, 100.),
|
||||||
|
list_hover: hsl(211.0, 97.0, 85.0).opacity(0.2),
|
||||||
|
muted: hsl(240.0, 4.8, 95.9),
|
||||||
|
muted_foreground: hsl(240.0, 3.8, 46.1),
|
||||||
|
panel: hsl(0.0, 0.0, 100.0),
|
||||||
popover: hsl(0.0, 0.0, 100.0),
|
popover: hsl(0.0, 0.0, 100.0),
|
||||||
popover_foreground: hsl(240.0, 10.0, 3.9),
|
popover_foreground: hsl(240.0, 10.0, 3.9),
|
||||||
primary: hsl(223.0, 5.9, 10.0),
|
primary: hsl(223.0, 5.9, 10.0),
|
||||||
primary_hover: hsl(223.0, 5.9, 15.0),
|
|
||||||
primary_active: hsl(223.0, 1.9, 25.0),
|
primary_active: hsl(223.0, 1.9, 25.0),
|
||||||
primary_foreground: hsl(223.0, 0.0, 98.0),
|
primary_foreground: hsl(223.0, 0.0, 98.0),
|
||||||
secondary: hsl(240.0, 5.9, 96.9),
|
primary_hover: hsl(223.0, 5.9, 15.0),
|
||||||
secondary_hover: hsl(240.0, 5.9, 98.),
|
progress_bar: hsl(223.0, 5.9, 10.0),
|
||||||
secondary_active: hsl(240.0, 5.9, 93.),
|
|
||||||
secondary_foreground: hsl(240.0, 59.0, 10.),
|
|
||||||
destructive: hsl(0.0, 84.2, 60.2),
|
|
||||||
destructive_hover: hsl(0.0, 84.2, 65.0),
|
|
||||||
destructive_active: hsl(0.0, 84.2, 47.0),
|
|
||||||
destructive_foreground: hsl(0.0, 0.0, 98.0),
|
|
||||||
muted: hsl(240.0, 4.8, 95.9),
|
|
||||||
muted_foreground: hsl(240.0, 3.8, 46.1),
|
|
||||||
accent: hsl(240.0, 5.0, 96.0),
|
|
||||||
accent_foreground: hsl(240.0, 5.9, 10.0),
|
|
||||||
border: hsl(240.0, 5.9, 90.0),
|
|
||||||
input: hsl(240.0, 5.9, 90.0),
|
|
||||||
ring: hsl(240.0, 5.9, 65.0),
|
ring: hsl(240.0, 5.9, 65.0),
|
||||||
selection: hsl(211.0, 97.0, 85.0),
|
|
||||||
scrollbar: hsl(0., 0., 97.).opacity(0.3),
|
scrollbar: hsl(0., 0., 97.).opacity(0.3),
|
||||||
scrollbar_thumb: hsl(0., 0., 69.),
|
scrollbar_thumb: hsl(0., 0., 69.),
|
||||||
panel: hsl(0.0, 0.0, 100.0),
|
secondary: hsl(240.0, 5.9, 96.9),
|
||||||
|
secondary_active: hsl(240.0, 5.9, 93.),
|
||||||
|
secondary_foreground: hsl(240.0, 59.0, 10.),
|
||||||
|
secondary_hover: hsl(240.0, 5.9, 98.),
|
||||||
|
selection: hsl(211.0, 97.0, 85.0),
|
||||||
|
skeleton: hsla(223.0, 5.9, 10.0, 0.1),
|
||||||
|
slider_bar: hsl(223.0, 5.9, 10.0),
|
||||||
|
slider_thumb: hsl(0.0, 0.0, 100.0),
|
||||||
|
tab: gpui::transparent_black(),
|
||||||
|
tab_active: hsl(0.0, 0.0, 100.0),
|
||||||
|
tab_active_foreground: hsl(240.0, 10., 3.9),
|
||||||
tab_bar: hsl(240.0, 4.8, 95.9),
|
tab_bar: hsl(240.0, 4.8, 95.9),
|
||||||
list: hsl(0.0, 0.0, 100.),
|
tab_foreground: hsl(240.0, 10., 3.9),
|
||||||
list_even: hsl(240.0, 5.0, 96.0),
|
table: hsl(0.0, 0.0, 100.),
|
||||||
list_head: hsl(0.0, 0.0, 100.),
|
table_active: hsl(211.0, 97.0, 85.0).opacity(0.2),
|
||||||
link: hsl(221.0, 83.0, 53.0),
|
table_active_border: hsl(211.0, 97.0, 85.0),
|
||||||
drop_target: hsl(235.0, 30., 44.0).opacity(0.25),
|
table_even: hsl(240.0, 5.0, 96.0),
|
||||||
|
table_head: hsl(0.0, 0.0, 100.),
|
||||||
|
table_head_foreground: hsl(240.0, 10., 3.9).opacity(0.7),
|
||||||
|
table_hover: hsl(211.0, 97.0, 85.0).opacity(0.2),
|
||||||
|
table_row_border: hsl(240.0, 5.9, 90.0).opacity(0.5),
|
||||||
|
title_bar: hsl(0.0, 0.0, 100.),
|
||||||
|
title_bar_border: hsl(240.0, 5.9, 90.0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dark() -> Colors {
|
pub fn dark() -> Self {
|
||||||
Colors {
|
Self {
|
||||||
title_bar: hsl(0., 0., 9.7),
|
accent: hsl(240.0, 3.7, 15.9),
|
||||||
title_bar_border: hsl(240.0, 3.7, 15.9),
|
accent_foreground: hsl(0.0, 0.0, 78.0),
|
||||||
|
accordion: hsl(299.0, 2., 11.),
|
||||||
|
accordion_active: hsl(240.0, 3.7, 16.9),
|
||||||
|
accordion_hover: hsl(240.0, 3.7, 15.9).opacity(0.7),
|
||||||
background: hsl(0.0, 0.0, 8.0),
|
background: hsl(0.0, 0.0, 8.0),
|
||||||
foreground: hsl(0., 0., 78.),
|
border: hsl(240.0, 3.7, 16.9),
|
||||||
card: hsl(299.0, 2., 11.),
|
card: hsl(299.0, 2., 11.),
|
||||||
card_foreground: hsl(0.0, 0.0, 78.0),
|
card_foreground: hsl(0.0, 0.0, 78.0),
|
||||||
|
destructive: hsl(0.0, 62.8, 30.6),
|
||||||
|
destructive_active: hsl(0.0, 62.8, 20.6),
|
||||||
|
destructive_foreground: hsl(0.0, 0.0, 78.0),
|
||||||
|
destructive_hover: hsl(0.0, 62.8, 35.6),
|
||||||
|
drag_border: crate::blue_500(),
|
||||||
|
drop_target: hsl(235.0, 30., 44.0).opacity(0.1),
|
||||||
|
foreground: hsl(0., 0., 78.),
|
||||||
|
input: hsl(240.0, 3.7, 15.9),
|
||||||
|
link: hsl(221.0, 83.0, 53.0),
|
||||||
|
link_active: hsl(221.0, 83.0, 53.0).darken(0.2),
|
||||||
|
link_hover: hsl(221.0, 83.0, 53.0).lighten(0.2),
|
||||||
|
list: hsl(0.0, 0.0, 8.0),
|
||||||
|
list_active: hsl(211.0, 97.0, 22.0).opacity(0.2),
|
||||||
|
list_active_border: hsl(211.0, 97.0, 22.0),
|
||||||
|
list_even: hsl(240.0, 3.7, 10.0),
|
||||||
|
list_head: hsl(0.0, 0.0, 8.0),
|
||||||
|
list_hover: hsl(211.0, 97.0, 22.0).opacity(0.2),
|
||||||
|
muted: hsl(240.0, 3.7, 15.9),
|
||||||
|
muted_foreground: hsl(240.0, 5.0, 64.9),
|
||||||
|
panel: hsl(299.0, 2., 11.),
|
||||||
popover: hsl(0.0, 0.0, 10.),
|
popover: hsl(0.0, 0.0, 10.),
|
||||||
popover_foreground: hsl(0.0, 0.0, 78.0),
|
popover_foreground: hsl(0.0, 0.0, 78.0),
|
||||||
primary: hsl(223.0, 0.0, 98.0),
|
primary: hsl(223.0, 0.0, 98.0),
|
||||||
primary_hover: hsl(223.0, 0.0, 90.0),
|
|
||||||
primary_active: hsl(223.0, 0.0, 80.0),
|
primary_active: hsl(223.0, 0.0, 80.0),
|
||||||
primary_foreground: hsl(223.0, 5.9, 10.0),
|
primary_foreground: hsl(223.0, 5.9, 10.0),
|
||||||
secondary: hsl(240.0, 0., 13.0),
|
primary_hover: hsl(223.0, 0.0, 90.0),
|
||||||
secondary_hover: hsl(240.0, 0., 15.),
|
progress_bar: hsl(223.0, 0.0, 98.0),
|
||||||
secondary_active: hsl(240.0, 0., 10.),
|
|
||||||
secondary_foreground: hsl(0.0, 0.0, 78.0),
|
|
||||||
destructive: hsl(0.0, 62.8, 30.6),
|
|
||||||
destructive_hover: hsl(0.0, 62.8, 35.6),
|
|
||||||
destructive_active: hsl(0.0, 62.8, 20.6),
|
|
||||||
destructive_foreground: hsl(0.0, 0.0, 78.0),
|
|
||||||
muted: hsl(240.0, 3.7, 15.9),
|
|
||||||
muted_foreground: hsl(240.0, 5.0, 64.9),
|
|
||||||
accent: hsl(240.0, 3.7, 15.9),
|
|
||||||
accent_foreground: hsl(0.0, 0.0, 78.0),
|
|
||||||
border: hsl(240.0, 3.7, 16.9),
|
|
||||||
input: hsl(240.0, 3.7, 15.9),
|
|
||||||
ring: hsl(240.0, 4.9, 83.9),
|
ring: hsl(240.0, 4.9, 83.9),
|
||||||
selection: hsl(211.0, 97.0, 22.0),
|
|
||||||
scrollbar: hsl(240., 1., 15.).opacity(0.3),
|
scrollbar: hsl(240., 1., 15.).opacity(0.3),
|
||||||
scrollbar_thumb: hsl(0., 0., 68.),
|
scrollbar_thumb: hsl(0., 0., 68.),
|
||||||
panel: hsl(299.0, 2., 11.),
|
secondary: hsl(240.0, 0., 13.0),
|
||||||
|
secondary_active: hsl(240.0, 0., 10.),
|
||||||
|
secondary_foreground: hsl(0.0, 0.0, 78.0),
|
||||||
|
secondary_hover: hsl(240.0, 0., 15.),
|
||||||
|
selection: hsl(211.0, 97.0, 22.0),
|
||||||
|
skeleton: hsla(223.0, 0.0, 98.0, 0.1),
|
||||||
|
slider_bar: hsl(223.0, 0.0, 98.0),
|
||||||
|
slider_thumb: hsl(0.0, 0.0, 8.0),
|
||||||
|
tab: gpui::transparent_black(),
|
||||||
|
tab_active: hsl(0.0, 0.0, 8.0),
|
||||||
|
tab_active_foreground: hsl(0., 0., 78.),
|
||||||
tab_bar: hsl(299.0, 0., 5.5),
|
tab_bar: hsl(299.0, 0., 5.5),
|
||||||
list: hsl(0.0, 0.0, 8.0),
|
tab_foreground: hsl(0., 0., 78.),
|
||||||
list_even: hsl(240.0, 3.7, 10.0),
|
table: hsl(0.0, 0.0, 8.0),
|
||||||
list_head: hsl(0.0, 0.0, 8.0),
|
table_active: hsl(211.0, 97.0, 22.0).opacity(0.2),
|
||||||
link: hsl(221.0, 83.0, 53.0),
|
table_active_border: hsl(211.0, 97.0, 22.0),
|
||||||
drop_target: hsl(235.0, 30., 44.0).opacity(0.1),
|
table_even: hsl(240.0, 3.7, 10.0),
|
||||||
|
table_head: hsl(0.0, 0.0, 8.0),
|
||||||
|
table_head_foreground: hsl(0., 0., 78.).opacity(0.7),
|
||||||
|
table_hover: hsl(211.0, 97.0, 22.0).opacity(0.2),
|
||||||
|
table_row_border: hsl(240.0, 3.7, 16.9).opacity(0.5),
|
||||||
|
title_bar: hsl(0., 0., 9.7),
|
||||||
|
title_bar_border: hsl(240.0, 3.7, 15.9),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -271,75 +345,73 @@ impl Colors {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Theme {
|
pub struct Theme {
|
||||||
pub mode: ThemeMode,
|
pub mode: ThemeMode,
|
||||||
pub transparent: Hsla,
|
pub accent: Hsla,
|
||||||
pub title_bar: Hsla,
|
pub accent_foreground: Hsla,
|
||||||
pub title_bar_border: Hsla,
|
pub accordion: Hsla,
|
||||||
/// Basic font size
|
pub accordion_active: Hsla,
|
||||||
pub font_size: f32,
|
pub accordion_hover: Hsla,
|
||||||
pub font_family: SharedString,
|
|
||||||
pub background: Hsla,
|
pub background: Hsla,
|
||||||
pub foreground: Hsla,
|
pub border: Hsla,
|
||||||
pub card: Hsla,
|
pub card: Hsla,
|
||||||
pub card_foreground: Hsla,
|
pub card_foreground: Hsla,
|
||||||
|
pub destructive: Hsla,
|
||||||
|
pub destructive_active: Hsla,
|
||||||
|
pub destructive_foreground: Hsla,
|
||||||
|
pub destructive_hover: Hsla,
|
||||||
|
pub drag_border: Hsla,
|
||||||
|
pub drop_target: Hsla,
|
||||||
|
pub font_family: SharedString,
|
||||||
|
pub font_size: f32,
|
||||||
|
pub foreground: Hsla,
|
||||||
|
pub input: Hsla,
|
||||||
|
pub link: Hsla,
|
||||||
|
pub link_active: Hsla,
|
||||||
|
pub link_hover: Hsla,
|
||||||
|
pub list: Hsla,
|
||||||
|
pub list_active: Hsla,
|
||||||
|
pub list_active_border: Hsla,
|
||||||
|
pub list_even: Hsla,
|
||||||
|
pub list_head: Hsla,
|
||||||
|
pub list_hover: Hsla,
|
||||||
|
pub muted: Hsla,
|
||||||
|
pub muted_foreground: Hsla,
|
||||||
|
pub panel: Hsla,
|
||||||
pub popover: Hsla,
|
pub popover: Hsla,
|
||||||
pub popover_foreground: Hsla,
|
pub popover_foreground: Hsla,
|
||||||
pub primary: Hsla,
|
pub primary: Hsla,
|
||||||
pub primary_hover: Hsla,
|
|
||||||
pub primary_active: Hsla,
|
pub primary_active: Hsla,
|
||||||
pub primary_foreground: Hsla,
|
pub primary_foreground: Hsla,
|
||||||
pub secondary: Hsla,
|
pub primary_hover: Hsla,
|
||||||
pub secondary_hover: Hsla,
|
pub progress_bar: Hsla,
|
||||||
pub secondary_active: Hsla,
|
pub radius: f32,
|
||||||
pub secondary_foreground: Hsla,
|
|
||||||
pub destructive: Hsla,
|
|
||||||
pub destructive_hover: Hsla,
|
|
||||||
pub destructive_active: Hsla,
|
|
||||||
pub destructive_foreground: Hsla,
|
|
||||||
pub muted: Hsla,
|
|
||||||
pub muted_foreground: Hsla,
|
|
||||||
pub accent: Hsla,
|
|
||||||
pub accent_foreground: Hsla,
|
|
||||||
pub border: Hsla,
|
|
||||||
pub input: Hsla,
|
|
||||||
pub ring: Hsla,
|
pub ring: Hsla,
|
||||||
/// Set to true to enable shadow for Button, Input, Dropdown, DatePicker ...
|
|
||||||
pub shadow: bool,
|
|
||||||
pub selection: Hsla,
|
|
||||||
pub scrollbar: Hsla,
|
pub scrollbar: Hsla,
|
||||||
pub scrollbar_thumb: Hsla,
|
pub scrollbar_thumb: Hsla,
|
||||||
pub panel: Hsla,
|
pub secondary: Hsla,
|
||||||
pub drag_border: Hsla,
|
pub secondary_active: Hsla,
|
||||||
pub drop_target: Hsla,
|
pub secondary_foreground: Hsla,
|
||||||
pub radius: f32,
|
pub secondary_hover: Hsla,
|
||||||
pub tab_bar: Hsla,
|
pub selection: Hsla,
|
||||||
pub tab: Hsla,
|
pub shadow: bool,
|
||||||
pub tab_active: Hsla,
|
pub skeleton: Hsla,
|
||||||
pub tab_foreground: Hsla,
|
|
||||||
pub tab_active_foreground: Hsla,
|
|
||||||
pub progress_bar: Hsla,
|
|
||||||
pub slider_bar: Hsla,
|
pub slider_bar: Hsla,
|
||||||
pub slider_thumb: Hsla,
|
pub slider_thumb: Hsla,
|
||||||
pub list: Hsla,
|
pub tab: Hsla,
|
||||||
pub list_even: Hsla,
|
pub tab_active: Hsla,
|
||||||
pub list_head: Hsla,
|
pub tab_active_foreground: Hsla,
|
||||||
pub list_active: Hsla,
|
pub tab_bar: Hsla,
|
||||||
pub list_active_border: Hsla,
|
pub tab_foreground: Hsla,
|
||||||
pub list_hover: Hsla,
|
|
||||||
pub table: Hsla,
|
pub table: Hsla,
|
||||||
|
pub table_active: Hsla,
|
||||||
|
pub table_active_border: Hsla,
|
||||||
pub table_even: Hsla,
|
pub table_even: Hsla,
|
||||||
pub table_head: Hsla,
|
pub table_head: Hsla,
|
||||||
pub table_head_foreground: Hsla,
|
pub table_head_foreground: Hsla,
|
||||||
pub table_row_border: Hsla,
|
|
||||||
pub table_active: Hsla,
|
|
||||||
pub table_active_border: Hsla,
|
|
||||||
pub table_hover: Hsla,
|
pub table_hover: Hsla,
|
||||||
pub link: Hsla,
|
pub table_row_border: Hsla,
|
||||||
pub link_hover: Hsla,
|
pub title_bar: Hsla,
|
||||||
pub link_active: Hsla,
|
pub title_bar_border: Hsla,
|
||||||
pub skeleton: Hsla,
|
pub transparent: Hsla,
|
||||||
pub accordion: Hsla,
|
|
||||||
pub accordion_hover: Hsla,
|
|
||||||
pub accordion_active: Hsla,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Global for Theme {}
|
impl Global for Theme {}
|
||||||
|
|
@ -349,6 +421,7 @@ impl Theme {
|
||||||
cx.global::<Self>()
|
cx.global::<Self>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Apply a mask color to the theme.
|
||||||
pub fn apply_color(&mut self, mask_color: Hsla) {
|
pub fn apply_color(&mut self, mask_color: Hsla) {
|
||||||
self.title_bar = self.title_bar.apply(mask_color);
|
self.title_bar = self.title_bar.apply(mask_color);
|
||||||
self.title_bar_border = self.title_bar_border.apply(mask_color);
|
self.title_bar_border = self.title_bar_border.apply(mask_color);
|
||||||
|
|
@ -415,8 +488,8 @@ impl Theme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Colors> for Theme {
|
impl From<ThemeColor> for Theme {
|
||||||
fn from(colors: Colors) -> Self {
|
fn from(colors: ThemeColor) -> Self {
|
||||||
Theme {
|
Theme {
|
||||||
mode: ThemeMode::default(),
|
mode: ThemeMode::default(),
|
||||||
transparent: Hsla::transparent_black(),
|
transparent: Hsla::transparent_black(),
|
||||||
|
|
@ -430,68 +503,68 @@ impl From<Colors> for Theme {
|
||||||
},
|
},
|
||||||
radius: 4.0,
|
radius: 4.0,
|
||||||
shadow: true,
|
shadow: true,
|
||||||
title_bar: colors.title_bar,
|
accent: colors.accent,
|
||||||
title_bar_border: colors.title_bar_border,
|
accent_foreground: colors.accent_foreground,
|
||||||
|
accordion: colors.accordion,
|
||||||
|
accordion_active: colors.accordion_active,
|
||||||
|
accordion_hover: colors.accordion_hover,
|
||||||
background: colors.background,
|
background: colors.background,
|
||||||
foreground: colors.foreground,
|
border: colors.border,
|
||||||
card: colors.card,
|
card: colors.card,
|
||||||
card_foreground: colors.card_foreground,
|
card_foreground: colors.card_foreground,
|
||||||
|
destructive: colors.destructive,
|
||||||
|
destructive_active: colors.destructive_active,
|
||||||
|
destructive_foreground: colors.destructive_foreground,
|
||||||
|
destructive_hover: colors.destructive_hover,
|
||||||
|
drag_border: colors.drag_border,
|
||||||
|
drop_target: colors.drop_target,
|
||||||
|
foreground: colors.foreground,
|
||||||
|
input: colors.input,
|
||||||
|
link: colors.link,
|
||||||
|
link_active: colors.link_active,
|
||||||
|
link_hover: colors.link_hover,
|
||||||
|
list: colors.list,
|
||||||
|
list_active: colors.list_active,
|
||||||
|
list_active_border: colors.list_active_border,
|
||||||
|
list_even: colors.list_even,
|
||||||
|
list_head: colors.list_head,
|
||||||
|
list_hover: colors.list_hover,
|
||||||
|
muted: colors.muted,
|
||||||
|
muted_foreground: colors.muted_foreground,
|
||||||
|
panel: colors.panel,
|
||||||
popover: colors.popover,
|
popover: colors.popover,
|
||||||
popover_foreground: colors.popover_foreground,
|
popover_foreground: colors.popover_foreground,
|
||||||
primary: colors.primary,
|
primary: colors.primary,
|
||||||
primary_hover: colors.primary_hover,
|
|
||||||
primary_active: colors.primary_active,
|
primary_active: colors.primary_active,
|
||||||
primary_foreground: colors.primary_foreground,
|
primary_foreground: colors.primary_foreground,
|
||||||
secondary: colors.secondary,
|
primary_hover: colors.primary_hover,
|
||||||
secondary_hover: colors.secondary_hover,
|
progress_bar: colors.progress_bar,
|
||||||
secondary_active: colors.secondary_active,
|
|
||||||
secondary_foreground: colors.secondary_foreground,
|
|
||||||
destructive: colors.destructive,
|
|
||||||
destructive_hover: colors.destructive_hover,
|
|
||||||
destructive_active: colors.destructive_active,
|
|
||||||
destructive_foreground: colors.destructive_foreground,
|
|
||||||
muted: colors.muted,
|
|
||||||
muted_foreground: colors.muted_foreground,
|
|
||||||
accent: colors.accent,
|
|
||||||
accent_foreground: colors.accent_foreground,
|
|
||||||
border: colors.border,
|
|
||||||
input: colors.input,
|
|
||||||
ring: colors.ring,
|
ring: colors.ring,
|
||||||
scrollbar: colors.scrollbar,
|
scrollbar: colors.scrollbar,
|
||||||
scrollbar_thumb: colors.scrollbar_thumb,
|
scrollbar_thumb: colors.scrollbar_thumb,
|
||||||
panel: colors.panel,
|
secondary: colors.secondary,
|
||||||
|
secondary_active: colors.secondary_active,
|
||||||
|
secondary_foreground: colors.secondary_foreground,
|
||||||
|
secondary_hover: colors.secondary_hover,
|
||||||
selection: colors.selection,
|
selection: colors.selection,
|
||||||
drag_border: crate::blue_500(),
|
skeleton: colors.skeleton,
|
||||||
drop_target: colors.drop_target,
|
slider_bar: colors.slider_bar,
|
||||||
|
slider_thumb: colors.slider_thumb,
|
||||||
|
tab: colors.tab,
|
||||||
|
tab_active: colors.tab_active,
|
||||||
|
tab_active_foreground: colors.tab_active_foreground,
|
||||||
tab_bar: colors.tab_bar,
|
tab_bar: colors.tab_bar,
|
||||||
tab: gpui::transparent_black(),
|
tab_foreground: colors.tab_foreground,
|
||||||
tab_active: colors.background,
|
table: colors.table,
|
||||||
tab_foreground: colors.foreground,
|
table_active: colors.table_active,
|
||||||
tab_active_foreground: colors.foreground,
|
table_active_border: colors.table_active_border,
|
||||||
progress_bar: colors.primary,
|
table_even: colors.table_even,
|
||||||
slider_bar: colors.primary,
|
table_head: colors.table_head,
|
||||||
slider_thumb: colors.background,
|
table_head_foreground: colors.table_head_foreground,
|
||||||
list: colors.list,
|
table_hover: colors.table_hover,
|
||||||
list_even: colors.list_even,
|
table_row_border: colors.table_row_border,
|
||||||
list_head: colors.list_head,
|
title_bar: colors.title_bar,
|
||||||
list_active: colors.selection.opacity(0.2),
|
title_bar_border: colors.title_bar_border,
|
||||||
list_active_border: colors.selection,
|
|
||||||
list_hover: colors.selection.opacity(0.2),
|
|
||||||
table_head: colors.list_head,
|
|
||||||
table: colors.list,
|
|
||||||
table_even: colors.list_even,
|
|
||||||
table_active: colors.selection.opacity(0.2),
|
|
||||||
table_active_border: colors.selection,
|
|
||||||
table_hover: colors.selection.opacity(0.2),
|
|
||||||
table_row_border: colors.border.opacity(0.5),
|
|
||||||
table_head_foreground: colors.foreground.opacity(0.7),
|
|
||||||
link: colors.link,
|
|
||||||
link_hover: colors.link.lighten(0.2),
|
|
||||||
link_active: colors.link.darken(0.2),
|
|
||||||
skeleton: hsla(colors.primary.h, colors.primary.s, colors.primary.l, 0.1),
|
|
||||||
accordion: colors.background,
|
|
||||||
accordion_hover: colors.tab_bar.opacity(0.7),
|
|
||||||
accordion_active: colors.tab_bar,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -524,8 +597,8 @@ impl Theme {
|
||||||
|
|
||||||
pub fn change(mode: ThemeMode, cx: &mut AppContext) {
|
pub fn change(mode: ThemeMode, cx: &mut AppContext) {
|
||||||
let colors = match mode {
|
let colors = match mode {
|
||||||
ThemeMode::Light => Colors::light(),
|
ThemeMode::Light => ThemeColor::light(),
|
||||||
ThemeMode::Dark => Colors::dark(),
|
ThemeMode::Dark => ThemeColor::dark(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut theme = Theme::from(colors);
|
let mut theme = Theme::from(colors);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue