theme: add info severity color token
This commit is contained in:
@@ -29,6 +29,8 @@ pub struct ThemeDefinition {
|
||||
pub success_foreground: Option<String>,
|
||||
pub warning: Option<String>,
|
||||
pub warning_foreground: Option<String>,
|
||||
pub info: Option<String>,
|
||||
pub info_foreground: Option<String>,
|
||||
pub border: Option<String>,
|
||||
pub input: Option<String>,
|
||||
pub ring: Option<String>,
|
||||
@@ -114,6 +116,14 @@ impl ThemeDefinition {
|
||||
parse_hex(self.warning_foreground.as_deref()?)
|
||||
}
|
||||
|
||||
pub fn info(&self) -> Option<Hsla> {
|
||||
parse_hex(self.info.as_deref()?)
|
||||
}
|
||||
|
||||
pub fn info_foreground(&self) -> Option<Hsla> {
|
||||
parse_hex(self.info_foreground.as_deref()?)
|
||||
}
|
||||
|
||||
pub fn border(&self) -> Option<Hsla> {
|
||||
parse_hex(self.border.as_deref()?)
|
||||
}
|
||||
@@ -206,11 +216,12 @@ mod tests {
|
||||
#[test]
|
||||
fn parses_a_full_definition() {
|
||||
let def = ThemeDefinition::parse_toml(
|
||||
"mode = \"dark\"\naccent = \"#7aa2f7\"\nbackground = \"#1a1b26\"\n",
|
||||
"mode = \"dark\"\naccent = \"#7aa2f7\"\nbackground = \"#1a1b26\"\ninfo = \"#38bdf8\"\n",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(def.mode, Some(crate::ThemeVariant::Dark));
|
||||
assert!(def.accent().is_some());
|
||||
assert!(def.info().is_some());
|
||||
assert!(def.foreground().is_none());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user