mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-09 22:52:51 +02:00
feat(bar): add accent config for themes
This commit is contained in:
Generated
+1
-1
@@ -599,7 +599,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "base16-egui-themes"
|
name = "base16-egui-themes"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/LGUG2Z/base16-egui-themes#b4afb9aa0104b6100d6be52b9fb2abb349a5de1e"
|
source = "git+https://github.com/LGUG2Z/base16-egui-themes#0dc75d5b136c479703290cac5285a2428958a075"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"egui",
|
"egui",
|
||||||
"schemars",
|
"schemars",
|
||||||
|
|||||||
+184
-2
@@ -1,4 +1,6 @@
|
|||||||
|
use crate::config::Base16Value;
|
||||||
use crate::config::Catppuccin;
|
use crate::config::Catppuccin;
|
||||||
|
use crate::config::CatppuccinValue;
|
||||||
use crate::config::KomobarConfig;
|
use crate::config::KomobarConfig;
|
||||||
use crate::config::Theme;
|
use crate::config::Theme;
|
||||||
use crate::komorebi::Komorebi;
|
use crate::komorebi::Komorebi;
|
||||||
@@ -51,26 +53,206 @@ impl Komobar {
|
|||||||
self.bg_color = Style::default().visuals.panel_fill;
|
self.bg_color = Style::default().visuals.panel_fill;
|
||||||
}
|
}
|
||||||
Some(theme) => match theme {
|
Some(theme) => match theme {
|
||||||
Theme::Catppuccin { name: catppuccin } => match catppuccin {
|
Theme::Catppuccin {
|
||||||
|
name: catppuccin,
|
||||||
|
accent: catppuccin_value,
|
||||||
|
} => match catppuccin {
|
||||||
Catppuccin::Frappe => {
|
Catppuccin::Frappe => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::FRAPPE);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::FRAPPE);
|
||||||
|
if let Some(catppuccin_value) = catppuccin_value {
|
||||||
|
let accent = match catppuccin_value {
|
||||||
|
CatppuccinValue::Rosewater => catppuccin_egui::FRAPPE.rosewater,
|
||||||
|
CatppuccinValue::Flamingo => catppuccin_egui::FRAPPE.flamingo,
|
||||||
|
CatppuccinValue::Pink => catppuccin_egui::FRAPPE.pink,
|
||||||
|
CatppuccinValue::Mauve => catppuccin_egui::FRAPPE.mauve,
|
||||||
|
CatppuccinValue::Red => catppuccin_egui::FRAPPE.red,
|
||||||
|
CatppuccinValue::Maroon => catppuccin_egui::FRAPPE.maroon,
|
||||||
|
CatppuccinValue::Peach => catppuccin_egui::FRAPPE.peach,
|
||||||
|
CatppuccinValue::Yellow => catppuccin_egui::FRAPPE.yellow,
|
||||||
|
CatppuccinValue::Green => catppuccin_egui::FRAPPE.green,
|
||||||
|
CatppuccinValue::Teal => catppuccin_egui::FRAPPE.teal,
|
||||||
|
CatppuccinValue::Sky => catppuccin_egui::FRAPPE.sky,
|
||||||
|
CatppuccinValue::Sapphire => catppuccin_egui::FRAPPE.sapphire,
|
||||||
|
CatppuccinValue::Blue => catppuccin_egui::FRAPPE.blue,
|
||||||
|
CatppuccinValue::Lavender => catppuccin_egui::FRAPPE.lavender,
|
||||||
|
CatppuccinValue::Text => catppuccin_egui::FRAPPE.text,
|
||||||
|
CatppuccinValue::Subtext1 => catppuccin_egui::FRAPPE.subtext1,
|
||||||
|
CatppuccinValue::Subtext0 => catppuccin_egui::FRAPPE.subtext0,
|
||||||
|
CatppuccinValue::Overlay2 => catppuccin_egui::FRAPPE.overlay2,
|
||||||
|
CatppuccinValue::Overlay1 => catppuccin_egui::FRAPPE.overlay1,
|
||||||
|
CatppuccinValue::Overlay0 => catppuccin_egui::FRAPPE.overlay0,
|
||||||
|
CatppuccinValue::Surface2 => catppuccin_egui::FRAPPE.surface2,
|
||||||
|
CatppuccinValue::Surface1 => catppuccin_egui::FRAPPE.surface1,
|
||||||
|
CatppuccinValue::Surface0 => catppuccin_egui::FRAPPE.surface0,
|
||||||
|
CatppuccinValue::Base => catppuccin_egui::FRAPPE.base,
|
||||||
|
CatppuccinValue::Mantle => catppuccin_egui::FRAPPE.mantle,
|
||||||
|
CatppuccinValue::Crust => catppuccin_egui::FRAPPE.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
}
|
||||||
self.bg_color = catppuccin_egui::FRAPPE.base;
|
self.bg_color = catppuccin_egui::FRAPPE.base;
|
||||||
}
|
}
|
||||||
Catppuccin::Latte => {
|
Catppuccin::Latte => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::LATTE);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::LATTE);
|
||||||
|
if let Some(catppuccin_value) = catppuccin_value {
|
||||||
|
let accent = match catppuccin_value {
|
||||||
|
CatppuccinValue::Rosewater => catppuccin_egui::LATTE.rosewater,
|
||||||
|
CatppuccinValue::Flamingo => catppuccin_egui::LATTE.flamingo,
|
||||||
|
CatppuccinValue::Pink => catppuccin_egui::LATTE.pink,
|
||||||
|
CatppuccinValue::Mauve => catppuccin_egui::LATTE.mauve,
|
||||||
|
CatppuccinValue::Red => catppuccin_egui::LATTE.red,
|
||||||
|
CatppuccinValue::Maroon => catppuccin_egui::LATTE.maroon,
|
||||||
|
CatppuccinValue::Peach => catppuccin_egui::LATTE.peach,
|
||||||
|
CatppuccinValue::Yellow => catppuccin_egui::LATTE.yellow,
|
||||||
|
CatppuccinValue::Green => catppuccin_egui::LATTE.green,
|
||||||
|
CatppuccinValue::Teal => catppuccin_egui::LATTE.teal,
|
||||||
|
CatppuccinValue::Sky => catppuccin_egui::LATTE.sky,
|
||||||
|
CatppuccinValue::Sapphire => catppuccin_egui::LATTE.sapphire,
|
||||||
|
CatppuccinValue::Blue => catppuccin_egui::LATTE.blue,
|
||||||
|
CatppuccinValue::Lavender => catppuccin_egui::LATTE.lavender,
|
||||||
|
CatppuccinValue::Text => catppuccin_egui::LATTE.text,
|
||||||
|
CatppuccinValue::Subtext1 => catppuccin_egui::LATTE.subtext1,
|
||||||
|
CatppuccinValue::Subtext0 => catppuccin_egui::LATTE.subtext0,
|
||||||
|
CatppuccinValue::Overlay2 => catppuccin_egui::LATTE.overlay2,
|
||||||
|
CatppuccinValue::Overlay1 => catppuccin_egui::LATTE.overlay1,
|
||||||
|
CatppuccinValue::Overlay0 => catppuccin_egui::LATTE.overlay0,
|
||||||
|
CatppuccinValue::Surface2 => catppuccin_egui::LATTE.surface2,
|
||||||
|
CatppuccinValue::Surface1 => catppuccin_egui::LATTE.surface1,
|
||||||
|
CatppuccinValue::Surface0 => catppuccin_egui::LATTE.surface0,
|
||||||
|
CatppuccinValue::Base => catppuccin_egui::LATTE.base,
|
||||||
|
CatppuccinValue::Mantle => catppuccin_egui::LATTE.mantle,
|
||||||
|
CatppuccinValue::Crust => catppuccin_egui::LATTE.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
}
|
||||||
self.bg_color = catppuccin_egui::LATTE.base;
|
self.bg_color = catppuccin_egui::LATTE.base;
|
||||||
}
|
}
|
||||||
Catppuccin::Macchiato => {
|
Catppuccin::Macchiato => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::MACCHIATO);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::MACCHIATO);
|
||||||
|
if let Some(catppuccin_value) = catppuccin_value {
|
||||||
|
let accent = match catppuccin_value {
|
||||||
|
CatppuccinValue::Rosewater => catppuccin_egui::MACCHIATO.rosewater,
|
||||||
|
CatppuccinValue::Flamingo => catppuccin_egui::MACCHIATO.flamingo,
|
||||||
|
CatppuccinValue::Pink => catppuccin_egui::MACCHIATO.pink,
|
||||||
|
CatppuccinValue::Mauve => catppuccin_egui::MACCHIATO.mauve,
|
||||||
|
CatppuccinValue::Red => catppuccin_egui::MACCHIATO.red,
|
||||||
|
CatppuccinValue::Maroon => catppuccin_egui::MACCHIATO.maroon,
|
||||||
|
CatppuccinValue::Peach => catppuccin_egui::MACCHIATO.peach,
|
||||||
|
CatppuccinValue::Yellow => catppuccin_egui::MACCHIATO.yellow,
|
||||||
|
CatppuccinValue::Green => catppuccin_egui::MACCHIATO.green,
|
||||||
|
CatppuccinValue::Teal => catppuccin_egui::MACCHIATO.teal,
|
||||||
|
CatppuccinValue::Sky => catppuccin_egui::MACCHIATO.sky,
|
||||||
|
CatppuccinValue::Sapphire => catppuccin_egui::MACCHIATO.sapphire,
|
||||||
|
CatppuccinValue::Blue => catppuccin_egui::MACCHIATO.blue,
|
||||||
|
CatppuccinValue::Lavender => catppuccin_egui::MACCHIATO.lavender,
|
||||||
|
CatppuccinValue::Text => catppuccin_egui::MACCHIATO.text,
|
||||||
|
CatppuccinValue::Subtext1 => catppuccin_egui::MACCHIATO.subtext1,
|
||||||
|
CatppuccinValue::Subtext0 => catppuccin_egui::MACCHIATO.subtext0,
|
||||||
|
CatppuccinValue::Overlay2 => catppuccin_egui::MACCHIATO.overlay2,
|
||||||
|
CatppuccinValue::Overlay1 => catppuccin_egui::MACCHIATO.overlay1,
|
||||||
|
CatppuccinValue::Overlay0 => catppuccin_egui::MACCHIATO.overlay0,
|
||||||
|
CatppuccinValue::Surface2 => catppuccin_egui::MACCHIATO.surface2,
|
||||||
|
CatppuccinValue::Surface1 => catppuccin_egui::MACCHIATO.surface1,
|
||||||
|
CatppuccinValue::Surface0 => catppuccin_egui::MACCHIATO.surface0,
|
||||||
|
CatppuccinValue::Base => catppuccin_egui::MACCHIATO.base,
|
||||||
|
CatppuccinValue::Mantle => catppuccin_egui::MACCHIATO.mantle,
|
||||||
|
CatppuccinValue::Crust => catppuccin_egui::MACCHIATO.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
}
|
||||||
self.bg_color = catppuccin_egui::MACCHIATO.base;
|
self.bg_color = catppuccin_egui::MACCHIATO.base;
|
||||||
}
|
}
|
||||||
Catppuccin::Mocha => {
|
Catppuccin::Mocha => {
|
||||||
catppuccin_egui::set_theme(ctx, catppuccin_egui::MOCHA);
|
catppuccin_egui::set_theme(ctx, catppuccin_egui::MOCHA);
|
||||||
|
if let Some(catppuccin_value) = catppuccin_value {
|
||||||
|
let accent = match catppuccin_value {
|
||||||
|
CatppuccinValue::Rosewater => catppuccin_egui::MOCHA.rosewater,
|
||||||
|
CatppuccinValue::Flamingo => catppuccin_egui::MOCHA.flamingo,
|
||||||
|
CatppuccinValue::Pink => catppuccin_egui::MOCHA.pink,
|
||||||
|
CatppuccinValue::Mauve => catppuccin_egui::MOCHA.mauve,
|
||||||
|
CatppuccinValue::Red => catppuccin_egui::MOCHA.red,
|
||||||
|
CatppuccinValue::Maroon => catppuccin_egui::MOCHA.maroon,
|
||||||
|
CatppuccinValue::Peach => catppuccin_egui::MOCHA.peach,
|
||||||
|
CatppuccinValue::Yellow => catppuccin_egui::MOCHA.yellow,
|
||||||
|
CatppuccinValue::Green => catppuccin_egui::MOCHA.green,
|
||||||
|
CatppuccinValue::Teal => catppuccin_egui::MOCHA.teal,
|
||||||
|
CatppuccinValue::Sky => catppuccin_egui::MOCHA.sky,
|
||||||
|
CatppuccinValue::Sapphire => catppuccin_egui::MOCHA.sapphire,
|
||||||
|
CatppuccinValue::Blue => catppuccin_egui::MOCHA.blue,
|
||||||
|
CatppuccinValue::Lavender => catppuccin_egui::MOCHA.lavender,
|
||||||
|
CatppuccinValue::Text => catppuccin_egui::MOCHA.text,
|
||||||
|
CatppuccinValue::Subtext1 => catppuccin_egui::MOCHA.subtext1,
|
||||||
|
CatppuccinValue::Subtext0 => catppuccin_egui::MOCHA.subtext0,
|
||||||
|
CatppuccinValue::Overlay2 => catppuccin_egui::MOCHA.overlay2,
|
||||||
|
CatppuccinValue::Overlay1 => catppuccin_egui::MOCHA.overlay1,
|
||||||
|
CatppuccinValue::Overlay0 => catppuccin_egui::MOCHA.overlay0,
|
||||||
|
CatppuccinValue::Surface2 => catppuccin_egui::MOCHA.surface2,
|
||||||
|
CatppuccinValue::Surface1 => catppuccin_egui::MOCHA.surface1,
|
||||||
|
CatppuccinValue::Surface0 => catppuccin_egui::MOCHA.surface0,
|
||||||
|
CatppuccinValue::Base => catppuccin_egui::MOCHA.base,
|
||||||
|
CatppuccinValue::Mantle => catppuccin_egui::MOCHA.mantle,
|
||||||
|
CatppuccinValue::Crust => catppuccin_egui::MOCHA.crust,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
style.visuals.override_text_color = None;
|
||||||
|
});
|
||||||
|
}
|
||||||
self.bg_color = catppuccin_egui::MOCHA.base;
|
self.bg_color = catppuccin_egui::MOCHA.base;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Theme::Base16 { name: base16 } => {
|
Theme::Base16 {
|
||||||
|
name: base16,
|
||||||
|
accent: base16_value,
|
||||||
|
} => {
|
||||||
ctx.set_style(base16.style());
|
ctx.set_style(base16.style());
|
||||||
|
if let Some(base16_value) = base16_value {
|
||||||
|
let accent = match base16_value {
|
||||||
|
Base16Value::Base00 => base16.base00(),
|
||||||
|
Base16Value::Base01 => base16.base01(),
|
||||||
|
Base16Value::Base02 => base16.base02(),
|
||||||
|
Base16Value::Base03 => base16.base03(),
|
||||||
|
Base16Value::Base04 => base16.base04(),
|
||||||
|
Base16Value::Base05 => base16.base05(),
|
||||||
|
Base16Value::Base06 => base16.base06(),
|
||||||
|
Base16Value::Base07 => base16.base07(),
|
||||||
|
Base16Value::Base08 => base16.base08(),
|
||||||
|
Base16Value::Base09 => base16.base09(),
|
||||||
|
Base16Value::Base0A => base16.base0a(),
|
||||||
|
Base16Value::Base0B => base16.base0b(),
|
||||||
|
Base16Value::Base0C => base16.base0c(),
|
||||||
|
Base16Value::Base0D => base16.base0d(),
|
||||||
|
Base16Value::Base0E => base16.base0e(),
|
||||||
|
Base16Value::Base0F => base16.base0f(),
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.style_mut(|style| {
|
||||||
|
style.visuals.selection.stroke.color = accent;
|
||||||
|
style.visuals.widgets.hovered.fg_stroke.color = accent;
|
||||||
|
style.visuals.widgets.active.fg_stroke.color = accent;
|
||||||
|
});
|
||||||
|
}
|
||||||
self.bg_color = base16.background();
|
self.bg_color = base16.background();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -98,9 +98,36 @@ impl From<Position> for Pos2 {
|
|||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum Theme {
|
pub enum Theme {
|
||||||
/// A theme from catppuccin-egui
|
/// A theme from catppuccin-egui
|
||||||
Catppuccin { name: Catppuccin },
|
Catppuccin {
|
||||||
|
name: Catppuccin,
|
||||||
|
accent: Option<CatppuccinValue>,
|
||||||
|
},
|
||||||
/// A theme from base16-egui-themes
|
/// A theme from base16-egui-themes
|
||||||
Base16 { name: Base16 },
|
Base16 {
|
||||||
|
name: Base16,
|
||||||
|
accent: Option<Base16Value>,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||||
|
pub enum Base16Value {
|
||||||
|
Base00,
|
||||||
|
Base01,
|
||||||
|
Base02,
|
||||||
|
Base03,
|
||||||
|
Base04,
|
||||||
|
Base05,
|
||||||
|
#[default]
|
||||||
|
Base06,
|
||||||
|
Base07,
|
||||||
|
Base08,
|
||||||
|
Base09,
|
||||||
|
Base0A,
|
||||||
|
Base0B,
|
||||||
|
Base0C,
|
||||||
|
Base0D,
|
||||||
|
Base0E,
|
||||||
|
Base0F,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
@@ -110,3 +137,34 @@ pub enum Catppuccin {
|
|||||||
Macchiato,
|
Macchiato,
|
||||||
Mocha,
|
Mocha,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
|
||||||
|
pub enum CatppuccinValue {
|
||||||
|
Rosewater,
|
||||||
|
Flamingo,
|
||||||
|
Pink,
|
||||||
|
Mauve,
|
||||||
|
Red,
|
||||||
|
Maroon,
|
||||||
|
Peach,
|
||||||
|
Yellow,
|
||||||
|
Green,
|
||||||
|
Teal,
|
||||||
|
Sky,
|
||||||
|
Sapphire,
|
||||||
|
Blue,
|
||||||
|
Lavender,
|
||||||
|
#[default]
|
||||||
|
Text,
|
||||||
|
Subtext1,
|
||||||
|
Subtext0,
|
||||||
|
Overlay2,
|
||||||
|
Overlay1,
|
||||||
|
Overlay0,
|
||||||
|
Surface2,
|
||||||
|
Surface1,
|
||||||
|
Surface0,
|
||||||
|
Base,
|
||||||
|
Mantle,
|
||||||
|
Crust,
|
||||||
|
}
|
||||||
|
|||||||
@@ -785,6 +785,37 @@
|
|||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accent": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Rosewater",
|
||||||
|
"Flamingo",
|
||||||
|
"Pink",
|
||||||
|
"Mauve",
|
||||||
|
"Red",
|
||||||
|
"Maroon",
|
||||||
|
"Peach",
|
||||||
|
"Yellow",
|
||||||
|
"Green",
|
||||||
|
"Teal",
|
||||||
|
"Sky",
|
||||||
|
"Sapphire",
|
||||||
|
"Blue",
|
||||||
|
"Lavender",
|
||||||
|
"Text",
|
||||||
|
"Subtext1",
|
||||||
|
"Subtext0",
|
||||||
|
"Overlay2",
|
||||||
|
"Overlay1",
|
||||||
|
"Overlay0",
|
||||||
|
"Surface2",
|
||||||
|
"Surface1",
|
||||||
|
"Surface0",
|
||||||
|
"Base",
|
||||||
|
"Mantle",
|
||||||
|
"Crust"
|
||||||
|
]
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
@@ -810,6 +841,27 @@
|
|||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accent": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Base00",
|
||||||
|
"Base01",
|
||||||
|
"Base02",
|
||||||
|
"Base03",
|
||||||
|
"Base04",
|
||||||
|
"Base05",
|
||||||
|
"Base06",
|
||||||
|
"Base07",
|
||||||
|
"Base08",
|
||||||
|
"Base09",
|
||||||
|
"Base0A",
|
||||||
|
"Base0B",
|
||||||
|
"Base0C",
|
||||||
|
"Base0D",
|
||||||
|
"Base0E",
|
||||||
|
"Base0F"
|
||||||
|
]
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
|||||||
Reference in New Issue
Block a user