button: Fix selected style for outline button. (#1070)
This commit is contained in:
parent
6a3a5f8a4c
commit
7f3f2a3940
4 changed files with 26 additions and 63 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use anyhow::anyhow;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
|
||||
use gpui::AssetSource;
|
||||
use rust_embed::RustEmbed;
|
||||
|
|
@ -10,7 +12,11 @@ use rust_embed::RustEmbed;
|
|||
pub struct Assets;
|
||||
|
||||
impl AssetSource for Assets {
|
||||
fn load(&self, path: &str) -> gpui::Result<Option<std::borrow::Cow<'static, [u8]>>> {
|
||||
fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
|
||||
if path.is_empty() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
Self::get(path)
|
||||
.map(|f| Some(f.data))
|
||||
.ok_or_else(|| anyhow!("could not find asset at path \"{}\"", path))
|
||||
|
|
|
|||
|
|
@ -849,64 +849,22 @@ impl ButtonVariant {
|
|||
|
||||
fn selected(&self, outline: bool, cx: &mut App) -> ButtonVariantStyle {
|
||||
let bg = match self {
|
||||
ButtonVariant::Primary => {
|
||||
if outline {
|
||||
cx.theme().primary
|
||||
} else {
|
||||
cx.theme().primary_active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Secondary | ButtonVariant::Ghost => {
|
||||
if outline {
|
||||
cx.theme().secondary
|
||||
} else {
|
||||
cx.theme().secondary_active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Danger => {
|
||||
if outline {
|
||||
cx.theme().danger
|
||||
} else {
|
||||
cx.theme().danger_active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Warning => {
|
||||
if outline {
|
||||
cx.theme().warning
|
||||
} else {
|
||||
cx.theme().warning_active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Success => {
|
||||
if outline {
|
||||
cx.theme().success
|
||||
} else {
|
||||
cx.theme().success_active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Info => {
|
||||
if outline {
|
||||
cx.theme().info
|
||||
} else {
|
||||
cx.theme().info_active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Primary => cx.theme().primary_active,
|
||||
ButtonVariant::Secondary | ButtonVariant::Ghost => cx.theme().secondary_active,
|
||||
ButtonVariant::Danger => cx.theme().danger_active,
|
||||
ButtonVariant::Warning => cx.theme().warning_active,
|
||||
ButtonVariant::Success => cx.theme().success_active,
|
||||
ButtonVariant::Info => cx.theme().info_active,
|
||||
ButtonVariant::Link => cx.theme().transparent,
|
||||
ButtonVariant::Text => cx.theme().transparent,
|
||||
ButtonVariant::Custom(colors) => {
|
||||
if outline {
|
||||
colors.color
|
||||
} else {
|
||||
colors.active
|
||||
}
|
||||
}
|
||||
ButtonVariant::Custom(colors) => colors.active,
|
||||
};
|
||||
|
||||
let border = self.border_color(bg, outline, cx);
|
||||
let fg = match self {
|
||||
ButtonVariant::Link => cx.theme().link_active,
|
||||
ButtonVariant::Text => cx.theme().foreground.opacity(0.7),
|
||||
_ => self.text_color(outline, cx),
|
||||
_ => self.text_color(false, cx),
|
||||
};
|
||||
let underline = self.underline(cx);
|
||||
let shadow = self.shadow(outline, cx);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"accordion.background": "#040404",
|
||||
"accordion.hover.background": "#4b6479",
|
||||
"background": "#040404",
|
||||
"border": "#333333",
|
||||
"border": "#282828",
|
||||
"card.background": "#003a5b",
|
||||
"card.foreground": "#feffff",
|
||||
"danger.background": "#d84a33",
|
||||
|
|
@ -52,7 +52,6 @@
|
|||
"table.head.foreground": "#feffffb3",
|
||||
"table.row.border": "#4b647970",
|
||||
"title_bar.background": "#040404",
|
||||
"title_bar.border": "#333333",
|
||||
"base.red": "#d84a33",
|
||||
"base.red.light": "#d76b42",
|
||||
"base.green": "#5da602",
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@
|
|||
"mode": "dark",
|
||||
"colors": {
|
||||
"accent.background": "#171717",
|
||||
"accent.foreground": "#dcdcdc",
|
||||
"accent.foreground": "#FFFFCE",
|
||||
"accordion.active.background": "#1e1e1e",
|
||||
"accordion.background": "#2e2e2e",
|
||||
"accordion.hover.background": "#3e3e3e",
|
||||
"background": "#000000",
|
||||
"border": "#444444",
|
||||
"border": "#252525",
|
||||
"card.background": "#090909",
|
||||
"card.foreground": "#dcdcdc",
|
||||
"card.foreground": "#FFFFCE",
|
||||
"danger.background": "#593002",
|
||||
"danger.active.background": "#4b2901",
|
||||
"danger.hover.background": "#593002AA",
|
||||
"foreground": "#FFFFCE",
|
||||
"input.border": "#3e3e3e",
|
||||
"input.border": "#252525",
|
||||
"list.active.background": "#21010122",
|
||||
"list.active.border": "#720202",
|
||||
"list.hover.background": "#111111",
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
"muted.foreground": "#828282",
|
||||
"panel.background": "#1e1e1e",
|
||||
"popover.background": "#090909",
|
||||
"popover.foreground": "#dcdcdc",
|
||||
"popover.foreground": "#FFFFCE",
|
||||
"primary.active.background": "#570101",
|
||||
"primary.background": "#720202",
|
||||
"primary.foreground": "#FFFFCE",
|
||||
|
|
@ -43,16 +43,16 @@
|
|||
"tab.foreground": "#808080",
|
||||
"table.background": "#1e1e1e00",
|
||||
"table.hover.background": "#1E1E1E",
|
||||
"base.red": "#720202",
|
||||
"base.red.light": "#c93636",
|
||||
"base.red": "#723202",
|
||||
"base.red.light": "#c97636",
|
||||
"base.green": "#047202",
|
||||
"base.green.light": "#39c936",
|
||||
"base.yellow": "#726302",
|
||||
"base.yellow.light": "#c9b536",
|
||||
"base.blue": "#022d72",
|
||||
"base.blue.light": "#0551cb",
|
||||
"base.magenta": "#5d0272",
|
||||
"base.magenta.light": "#ae36c9",
|
||||
"base.magenta": "#3a1d75",
|
||||
"base.magenta.light": "#6c36c9",
|
||||
"base.cyan": "#027272",
|
||||
"base.cyan.light": "#36c9c9"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue