summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/theme/palette.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs
index 83803c9a..d4ec84f2 100644
--- a/core/src/theme/palette.rs
+++ b/core/src/theme/palette.rs
@@ -317,6 +317,7 @@ impl Palette {
primary: color!(0xd1d1e0),
success: color!(0xb1b695),
danger: color!(0xe06b75),
+ warning: color!(0xf5d76e), // Honey
};
}
@@ -333,6 +334,8 @@ pub struct Extended {
pub success: Success,
/// The set of danger colors.
pub danger: Danger,
+ /// The set of warning colors.
+ pub warning: Warning,
/// Whether the palette is dark or not.
pub is_dark: bool,
}
@@ -446,6 +449,11 @@ impl Extended {
palette.background,
palette.text,
),
+ warning: Warning::generate(
+ palette.warning,
+ palette.background,
+ palette.text,
+ ),
is_dark: is_dark(palette.background),
}
}
@@ -601,6 +609,31 @@ impl Danger {
}
}
+/// A set of warning colors.
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct Warning {
+ /// The base warning color.
+ pub base: Pair,
+ /// A weaker version of the base warning color.
+ pub weak: Pair,
+ /// A stronger version of the base warning color.
+ pub strong: Pair,
+}
+
+impl Warning {
+ /// Generates a set of [`Warning`] colors from the base, background, and text colors.
+ pub fn generate(base: Color, background: Color, text: Color) -> Self {
+ let weak = mix(base, background, 0.4);
+ let strong = deviate(base, 0.1);
+
+ Self {
+ base: Pair::new(base, text),
+ weak: Pair::new(weak, text),
+ strong: Pair::new(strong, text),
+ }
+ }
+}
+
fn darken(color: Color, amount: f32) -> Color {
let mut hsl = to_hsl(color);