Skip to content

Commit

Permalink
Add a light variation of Dracula.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuamegnauth54 committed Aug 7, 2023
1 parent a344376 commit ff0c702
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
24 changes: 15 additions & 9 deletions src/gui/styles/types/custom_styles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ pub struct PaletteExtension {
#[derive(Clone, Copy, Serialize, Deserialize, Debug, Hash, PartialEq)]
#[serde(tag = "custom")]
pub enum ExtraStyles {
Dracula,
DraculaDay,
DraculaNight,
GruvboxDark,
GruvboxLight,
NordLight,
Expand All @@ -48,7 +49,8 @@ impl ExtraStyles {
#[inline]
pub fn to_palette(self) -> Palette {
match self {
ExtraStyles::Dracula => dracula::dracula().palette,
ExtraStyles::DraculaDay => dracula::dracula_light().palette,
ExtraStyles::DraculaNight => dracula::dracula_dark().palette,
ExtraStyles::GruvboxDark => gruvbox::gruvbox_dark().palette,
ExtraStyles::GruvboxLight => gruvbox::gruvbox_light().palette,
ExtraStyles::NordLight => nord::nord_day().palette,
Expand All @@ -62,7 +64,8 @@ impl ExtraStyles {
#[inline]
pub fn to_ext(self) -> PaletteExtension {
match self {
ExtraStyles::Dracula => dracula::dracula().extension,
ExtraStyles::DraculaDay => dracula::dracula_light().extension,
ExtraStyles::DraculaNight => dracula::dracula_dark().extension,
ExtraStyles::GruvboxDark => gruvbox::gruvbox_dark().extension,
ExtraStyles::GruvboxLight => gruvbox::gruvbox_light().extension,
ExtraStyles::NordLight => nord::nord_day().extension,
Expand All @@ -76,21 +79,23 @@ impl ExtraStyles {
#[inline]
pub const fn is_nightly(self) -> bool {
match self {
ExtraStyles::Dracula
ExtraStyles::DraculaNight
| ExtraStyles::GruvboxDark
| ExtraStyles::NordDark
| ExtraStyles::SolarizedDark => true,
ExtraStyles::GruvboxLight | ExtraStyles::NordLight | ExtraStyles::SolarizedLight => {
false
}
ExtraStyles::DraculaDay
| ExtraStyles::GruvboxLight
| ExtraStyles::NordLight
| ExtraStyles::SolarizedLight => false,
}
}

/// Slice of all implemented custom styles
#[inline]
pub const fn all_styles() -> &'static [Self] {
&[
ExtraStyles::Dracula,
ExtraStyles::DraculaDay,
ExtraStyles::DraculaNight,
ExtraStyles::GruvboxDark,
ExtraStyles::GruvboxLight,
ExtraStyles::NordLight,
Expand All @@ -104,7 +109,8 @@ impl ExtraStyles {
impl fmt::Display for ExtraStyles {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ExtraStyles::Dracula => write!(f, "Dracula"),
ExtraStyles::DraculaDay => write!(f, "Dracula (Day)"),
ExtraStyles::DraculaNight => write!(f, "Dracula (Night)"),
ExtraStyles::GruvboxDark => write!(f, "Gruvbox (Night)"),
ExtraStyles::GruvboxLight => write!(f, "Gruvbox (Day)"),
ExtraStyles::NordLight => write!(f, "Nord (Day)"),
Expand Down
24 changes: 22 additions & 2 deletions src/gui/styles/types/custom_styles/dracula.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

//! Dracula theme
//! <https://draculatheme.com/>
//! Light style from: https://github.com/AshGrowem/Dracula.min/
use iced::color;

use super::{CustomPalette, Palette, PaletteExtension};

pub(super) fn dracula() -> CustomPalette {
pub(super) fn dracula_dark() -> CustomPalette {
CustomPalette {
palette: Palette {
primary: color!(0x282a36), // Backgorund
primary: color!(0x282a36), // Background
secondary: color!(0xff79c6), // Pink
outgoing: color!(0x8be9fd), // Cyan
buttons: color!(0x6272a4), // Comments
Expand All @@ -24,3 +25,22 @@ pub(super) fn dracula() -> CustomPalette {
},
}
}

pub(super) fn dracula_light() -> CustomPalette {
CustomPalette {
palette: Palette {
primary: color!(0xf1f2ff),
secondary: color!(0xff79c6),
outgoing: color!(0x8be9fd),
buttons: color!(0xcbcee5),
text_headers: color!(0xf1f2ff),
text_body: color!(0x282a36),
},
extension: PaletteExtension {
starred: color!(0xf1fa8c, 0.7),
chart_badge_alpha: 0.25,
round_borders_alpha: 0.15,
round_containers_alpha: 0.05,
},
}
}

0 comments on commit ff0c702

Please sign in to comment.