Skip to content

Commit

Permalink
Add nord-dark and nord-light color schemes
Browse files Browse the repository at this point in the history
Fix carl dark export bug
  • Loading branch information
thebashpotato committed Apr 24, 2024
1 parent d7b8e9e commit 81511d5
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 18 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ license-file = "LICENSE"

[features]
default = ["standard"]
all_themes = ["standard", "carl"]
all_themes = ["standard", "carl", "nord"]
standard = []
carl = []
nord = []

[dependencies]
egui = "0.27"
Expand Down
Binary file added assets/nord_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/themes/carl/dark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ impl Aesthetix for CarlDark {
}

fn margin_style(&self) -> f32 {
10.0
12.0
}

fn button_padding(&self) -> egui::Vec2 {
egui::Vec2 { x: 10.0, y: 8.0 }
egui::Vec2 { x: 12.0, y: 10.0 }
}

fn item_spacing_style(&self) -> f32 {
15.0
18.0
}

fn scroll_bar_width_style(&self) -> f32 {
12.0
14.0
}

fn rounding_visuals(&self) -> f32 {
8.0
6.0
}
}
2 changes: 2 additions & 0 deletions src/themes/carl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Carl Dark theme, no light theme currently exists

mod dark;

pub use dark::CarlDark;
4 changes: 4 additions & 0 deletions src/themes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
//! be located in this folder

mod carl;
mod nord;
mod standard;

#[cfg(feature = "carl")]
pub use carl::CarlDark;

#[cfg(feature = "nord")]
pub use nord::{NordDark, NordLight};

#[cfg(feature = "standard")]
pub use standard::{StandardDark, StandardLight};
82 changes: 82 additions & 0 deletions src/themes/nord/dark.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//! Nord Light theme
//! <https://www.nordtheme.com/>

use crate::Aesthetix;

/// Dark theme, with rounded buttons, and ample margin. Adapted from the Nord light
/// color scheme.
pub struct NordDark;

impl Aesthetix for NordDark {
fn name(&self) -> &str {
"Nord Dark"
}

fn primary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(94, 129, 172)
}

fn secondary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(129, 161, 193)
}

fn bg_primary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(46, 52, 64)
}

fn bg_secondary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(59, 66, 82)
}

fn bg_triage_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(59, 66, 82)
}

fn bg_auxiliary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(59, 66, 82)
}

fn bg_contrast_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(59, 66, 82)
}

fn fg_primary_text_color_visuals(&self) -> Option<egui::Color32> {
Some(egui::Color32::from_rgb(216, 222, 233))
}

fn fg_success_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(80, 250, 123)
}

fn fg_warn_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(255, 215, 64)
}

fn fg_error_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(255, 121, 121)
}

fn dark_mode_visuals(&self) -> bool {
true
}

fn margin_style(&self) -> f32 {
12.0
}

fn button_padding(&self) -> egui::Vec2 {
egui::Vec2 { x: 12.0, y: 10.0 }
}

fn item_spacing_style(&self) -> f32 {
18.0
}

fn scroll_bar_width_style(&self) -> f32 {
14.0
}

fn rounding_visuals(&self) -> f32 {
6.0
}
}
82 changes: 82 additions & 0 deletions src/themes/nord/light.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//! Nord Light theme
//! <https://www.nordtheme.com/>

use crate::Aesthetix;

/// Light theme, with rounded buttons, and ample margin. Adapted from the Nord light
/// color scheme.
pub struct NordLight;

impl Aesthetix for NordLight {
fn name(&self) -> &str {
"Nord Light"
}

fn primary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(104, 161, 210)
}

fn secondary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(129, 161, 193)
}

fn bg_primary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(216, 222, 233)
}

fn bg_secondary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(229, 233, 240)
}

fn bg_triage_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(255, 255, 255)
}

fn bg_auxiliary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(206, 212, 224)
}

fn bg_contrast_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(180, 186, 189)
}

fn fg_primary_text_color_visuals(&self) -> Option<egui::Color32> {
Some(egui::Color32::BLACK)
}

fn fg_success_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(82, 163, 137)
}

fn fg_warn_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(255, 179, 71)
}

fn fg_error_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(228, 97, 107)
}

fn dark_mode_visuals(&self) -> bool {
false
}

fn margin_style(&self) -> f32 {
12.0
}

fn button_padding(&self) -> egui::Vec2 {
egui::Vec2 { x: 12.0, y: 10.0 }
}

fn item_spacing_style(&self) -> f32 {
18.0
}

fn scroll_bar_width_style(&self) -> f32 {
14.0
}

fn rounding_visuals(&self) -> f32 {
6.0
}
}
11 changes: 11 additions & 0 deletions src/themes/nord/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Nord Dark and Light themes
//!
//! The [`egui_aesthetix::themes::NordDark`] and [`egui_aesthetix::themes::NordLight`]
//! structs are good examples on how to implement a theme you want using the
//! [`egui_aesthetix::Aesthetix`] trait.

mod dark;
mod light;

pub use dark::NordDark;
pub use light::NordLight;
13 changes: 7 additions & 6 deletions src/themes/standard/dark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

use crate::Aesthetix;

/// A Standard dark theme, with rounded buttons, and ample margin.
/// A Standard dark theme, with rounded buttons, and ample margin. Adapted from the Gnome dark
/// color scheme.
pub struct StandardDark;

impl Aesthetix for StandardDark {
Expand Down Expand Up @@ -60,22 +61,22 @@ impl Aesthetix for StandardDark {
}

fn margin_style(&self) -> f32 {
10.0
12.0
}

fn button_padding(&self) -> egui::Vec2 {
egui::Vec2 { x: 10.0, y: 8.0 }
egui::Vec2 { x: 12.0, y: 10.0 }
}

fn item_spacing_style(&self) -> f32 {
15.0
18.0
}

fn scroll_bar_width_style(&self) -> f32 {
12.0
14.0
}

fn rounding_visuals(&self) -> f32 {
8.0
6.0
}
}
13 changes: 7 additions & 6 deletions src/themes/standard/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

use crate::Aesthetix;

/// Standard dark theme, with rounded buttons, and ample margin.
/// Standard light theme, with rounded buttons, ample margin adapted from the Gnome light color
/// scheme.
pub struct StandardLight;

impl Aesthetix for StandardLight {
Expand Down Expand Up @@ -60,22 +61,22 @@ impl Aesthetix for StandardLight {
}

fn margin_style(&self) -> f32 {
10.0
12.0
}

fn button_padding(&self) -> egui::Vec2 {
egui::Vec2 { x: 10.0, y: 8.0 }
egui::Vec2 { x: 12.0, y: 10.0 }
}

fn item_spacing_style(&self) -> f32 {
15.0
18.0
}

fn scroll_bar_width_style(&self) -> f32 {
12.0
14.0
}

fn rounding_visuals(&self) -> f32 {
8.0
6.0
}
}

0 comments on commit 81511d5

Please sign in to comment.