-
-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft out skeleton for minimal custom themes.
For now, custom themes will use constant structs like in Sniffnet's original code. Custom themes will be self contained instead of polluting the original code base. This should make it easier for contributors to modify or add any extra themes without having to change code in too many files.
- Loading branch information
1 parent
2d00141
commit 54b4abf
Showing
5 changed files
with
58 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use std::fmt; | ||
|
||
use iced::Color; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::palette::Palette; | ||
|
||
/// Extension color for themes. | ||
pub struct PaletteExtension { | ||
/// Color of favorites star | ||
pub starred: Color, | ||
/// Badge/logo alpha | ||
pub badge_alpha: f32, | ||
/// Traffic chart color mixing | ||
pub color_mixing: f64, | ||
} | ||
|
||
/// Custom style with any relevant metadata | ||
// pub struct CustomPalette { | ||
// name: &'static str, | ||
// palette: Palette, | ||
// extension: PaletteExtension, | ||
//} | ||
|
||
#[derive(Clone, Copy, Serialize, Deserialize, Debug, Hash, PartialEq)] | ||
pub enum ExtraStyles { | ||
Dracula, | ||
} | ||
|
||
impl ExtraStyles { | ||
pub fn to_palette(self) -> Palette { | ||
match self { | ||
ExtraStyles::Dracula => unimplemented!(), | ||
} | ||
} | ||
|
||
pub fn to_ext(self) -> PaletteExtension { | ||
match self { | ||
ExtraStyles::Dracula => unimplemented!(), | ||
} | ||
} | ||
} | ||
|
||
impl fmt::Display for ExtraStyles { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match *self { | ||
ExtraStyles::Dracula => write!(f, "Dracula"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod custom_palette; | ||
pub mod element_type; | ||
pub mod palette; | ||
pub mod style_tuple; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters