Skip to content

Commit

Permalink
Add tokyo night color schemes
Browse files Browse the repository at this point in the history
Update screen shots and readme. Update version to 0.2.3. Ready for
publish.
  • Loading branch information
thebashpotato committed Apr 24, 2024
1 parent 81511d5 commit 88347e4
Show file tree
Hide file tree
Showing 16 changed files with 213 additions and 31 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "egui-aesthetix"
version = "0.2.2"
version = "0.2.3"
authors = ["Matt Williams <[email protected]>"]
description = "A Uniform and programmatic approach to theming Egui applications"
edition = "2021"
Expand All @@ -13,10 +13,11 @@ license-file = "LICENSE"

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

[dependencies]
egui = "0.27"
Expand Down
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ I like this method because it is trait based, so many themes could be added to t
1. Carl Dark
- Based off of the [Kde plasma theme](https://store.kde.org/p/1338881/)

2. Gruvbox (Light and Dark)
- TODO
2. Nord (Light and Dark)
- Based off the [ popular Nord theme](https://www.nordtheme.com/)

3. Nord (Light and Dark)
- TODO
3. Tokyo Night (Dark and Storm)
- Based off the [VSCode Extension](https://github.com/enkia/tokyo-night-vscode-theme)

4. Catppuccin (All versions)
4. Catpuccin
- TODO

### Checkout the results
Expand All @@ -66,6 +66,14 @@ I like this method because it is trait based, so many themes could be added to t
<br>
<h3>Carl Dark theme Kde on Plasma</h3>
<img alt="Standard Light" src="./assets/carl_dark.png">
<h3>Nord Dark</h3>
<img alt="Nord Dark" src="./assets/nord_dark.png">
<h3>Nord Light</h3>
<img alt="Nord Light" src="./assets/nord_light.png">
<h3>Tokyo Night</h3>
<img alt="Tokyo Night" src="./assets/tokyo_night.png">
<h3>Tokyo Night Sorm</h3>
<img alt="Tokyo Night Storm" src="./assets/tokyo_night_storm.png">
</div>
</details>

Expand All @@ -77,25 +85,37 @@ The library is very flexible and doesn't force you to include themes you don't w
> the StandardDark and StandardLight themes
```toml
egui-aesthetix = "0.2.2"
egui-aesthetix = "0.2.3"
```

> Only includes the Aesthetix trait, no themes will be included
```toml
egui-aesthetix = { version = "0.2.2", default-features = false }
egui-aesthetix = { version = "0.2.3", default-features = false }
```

> Include all the themes
```toml
egui-aesthetix = { version = "0.2.2", features = ["all_themes"] }
egui-aesthetix = { version = "0.2.3", features = ["all_themes"] }
```

> Only include standard themes and a specified theme (here carl is used as the specified theme)
```toml
egui-aesthetix = { version = "0.2.2", features = ["standard", "carl" ] }
egui-aesthetix = { version = "0.2.3", features = ["standard", "carl" ] }
```

> Only include nord themes
```toml
egui-aesthetix = { version = "0.2.3", features = ["nord"] }
```

> Only include tokyo night themes
```toml
egui-aesthetix = { version = "0.2.3", features = ["tokyo_night"] }
```

## Usage
Expand Down
Binary file modified assets/carl_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 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.
Binary file added assets/nord_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/standard_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/standard_light.png
Binary file not shown.
Binary file added assets/tokyo_night.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tokyo_night_storm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/themes/carl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//! Carl Dark theme, no light theme currently exists

mod dark;

pub use dark::CarlDark;
pub mod dark;
13 changes: 10 additions & 3 deletions src/themes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
mod carl;
mod nord;
mod standard;
mod tokyo_night;

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

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

#[cfg(feature = "tokyo_night")]
pub use tokyo_night::dark::TokyoNight;
pub use tokyo_night::storm::TokyoNightStorm;

#[cfg(feature = "standard")]
pub use standard::{StandardDark, StandardLight};
pub use standard::dark::StandardDark;
pub use standard::light::StandardLight;
11 changes: 2 additions & 9 deletions src/themes/nord/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
//! 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;
pub mod dark;
pub mod light;
7 changes: 2 additions & 5 deletions src/themes/standard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@
//! 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::StandardDark;
pub use light::StandardLight;
pub mod dark;
pub mod light;
81 changes: 81 additions & 0 deletions src/themes/tokyo_night/dark.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//! Tokyo Night theme
//! A port of the popular visual studio code theme: `<https://github.com/enkia/tokyo-night-vscode-theme>`

use crate::Aesthetix;

/// Tokyo Night theme.
pub struct TokyoNight;

impl Aesthetix for TokyoNight {
fn name(&self) -> &str {
"Tokyo Night"
}

fn primary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(113, 189, 251)
}

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

fn bg_primary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(34, 35, 39)
}

fn bg_secondary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(28, 29, 33)
}

fn bg_triage_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(41, 42, 46)
}

fn bg_auxiliary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(31, 32, 36)
}

fn bg_contrast_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgb(49, 50, 54)
}

fn fg_primary_text_color_visuals(&self) -> Option<egui::Color32> {
Some(egui::Color32::from_rgb(196, 200, 213))
}

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(229, 46, 47)
}

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
}
}
4 changes: 4 additions & 0 deletions src/themes/tokyo_night/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//! Tokyo night dark, storm, and light themes,

pub mod dark;
pub mod storm;
81 changes: 81 additions & 0 deletions src/themes/tokyo_night/storm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//! Tokyo Night Storm theme.
//! A port of the popular visual studio code theme: `https://github.com/enkia/tokyo-night-vscode-theme/blob/master/themes/tokyo-night-storm-color-theme.json`

use crate::Aesthetix;

/// Tokyo Night Storm.
pub struct TokyoNightStorm;

impl Aesthetix for TokyoNightStorm {
fn name(&self) -> &str {
"Tokyo Night Storm"
}

fn primary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(138, 171, 244, 255)
}

fn secondary_accent_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(97, 175, 239, 255)
}

fn bg_primary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(23, 24, 38, 255)
}

fn bg_secondary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(31, 31, 51, 255)
}

fn bg_triage_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(33, 35, 53, 255)
}

fn bg_auxiliary_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(27, 29, 45, 255)
}

fn bg_contrast_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(42, 42, 68, 255)
}

fn fg_primary_text_color_visuals(&self) -> Option<egui::Color32> {
Some(egui::Color32::from_rgba_premultiplied(204, 204, 204, 255))
}

fn fg_success_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(86, 209, 123, 255)
}

fn fg_warn_text_color_visuals(&self) -> egui::Color32 {
egui::Color32::from_rgba_premultiplied(255, 161, 90, 255)
}

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

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
}
}

0 comments on commit 88347e4

Please sign in to comment.