summaryrefslogtreecommitdiffstats
path: root/highlighter
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-20 01:21:42 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-20 01:21:42 +0200
commitff78e97ad7df4db3b2a97b94e99854f2f9e3021a (patch)
treea6cc540fcd92dad26155022f95f1d52e0473e509 /highlighter
parent93d6f748f69fc4ccf6c18f95c5f16b369c776da0 (diff)
downloadiced-ff78e97ad7df4db3b2a97b94e99854f2f9e3021a.tar.gz
iced-ff78e97ad7df4db3b2a97b94e99854f2f9e3021a.tar.bz2
iced-ff78e97ad7df4db3b2a97b94e99854f2f9e3021a.zip
Introduce more themes to `iced_highlighter`
Diffstat (limited to 'highlighter')
-rw-r--r--highlighter/src/lib.rs35
1 files changed, 28 insertions, 7 deletions
diff --git a/highlighter/src/lib.rs b/highlighter/src/lib.rs
index f5a4fae5..db28b5b1 100644
--- a/highlighter/src/lib.rs
+++ b/highlighter/src/lib.rs
@@ -161,19 +161,38 @@ impl Highlight {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Theme {
SolarizedDark,
- InspiredGitHub,
Base16Mocha,
+ Base16Ocean,
+ Base16Eighties,
+ InspiredGitHub,
}
impl Theme {
- pub const ALL: &[Self] =
- &[Self::SolarizedDark, Self::InspiredGitHub, Self::Base16Mocha];
+ pub const ALL: &[Self] = &[
+ Self::SolarizedDark,
+ Self::Base16Mocha,
+ Self::Base16Ocean,
+ Self::Base16Eighties,
+ Self::InspiredGitHub,
+ ];
+
+ pub fn is_dark(self) -> bool {
+ match self {
+ Self::SolarizedDark
+ | Self::Base16Mocha
+ | Self::Base16Ocean
+ | Self::Base16Eighties => true,
+ Self::InspiredGitHub => false,
+ }
+ }
fn key(&self) -> &'static str {
match self {
- Theme::InspiredGitHub => "InspiredGitHub",
- Theme::Base16Mocha => "base16-mocha.dark",
Theme::SolarizedDark => "Solarized (dark)",
+ Theme::Base16Mocha => "base16-mocha.dark",
+ Theme::Base16Ocean => "base16-ocean.dark",
+ Theme::Base16Eighties => "base16-eighties.dark",
+ Theme::InspiredGitHub => "InspiredGitHub",
}
}
}
@@ -181,9 +200,11 @@ impl Theme {
impl std::fmt::Display for Theme {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
- Theme::InspiredGitHub => write!(f, "Inspired GitHub"),
- Theme::Base16Mocha => write!(f, "Mocha"),
Theme::SolarizedDark => write!(f, "Solarized Dark"),
+ Theme::Base16Mocha => write!(f, "Mocha"),
+ Theme::Base16Ocean => write!(f, "Ocean"),
+ Theme::Base16Eighties => write!(f, "Eighties"),
+ Theme::InspiredGitHub => write!(f, "Inspired GitHub"),
}
}
}