summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-11-10 23:59:51 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-11-10 23:59:51 +0100
commitd2959aa212572d8f3107d70bee4657824d690f49 (patch)
tree6a07588e76ce37fafc15ff00a7def5a52857aefa
parentde9089c4681471b9cf6144f5ada88c4c803ecf12 (diff)
downloadvtcol-d2959aa212572d8f3107d70bee4657824d690f49.tar.gz
add green monochrome theme (phosphor)
-rw-r--r--src/vtcol.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs
index 81f586f..75bc699 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -106,10 +106,17 @@ impl fmt::Display for Color
#[derive(Debug)]
enum Scheme
{
+ /** Vanilla Linux colors. */
Default,
+ /** The dark (default) version of the Solarized scheme. */
SolarizedDark,
+ /** The light version of the Solarized theme. */
SolarizedLight,
+ /** Bright green monochrome terminal. */
+ Phosphor,
+ /** Custom ``Palette``. */
Palette(Palette),
+ /** Load from file. */
Custom(Option<PathBuf>),
}
@@ -121,6 +128,7 @@ impl<'a> fmt::Display for Scheme
Self::Default => write!(f, "default"),
Self::SolarizedDark => write!(f, "solarized_dark"),
Self::SolarizedLight => write!(f, "solarized_light"),
+ Self::Phosphor => write!(f, "phosphor"),
Self::Custom(None) => write!(f, "<read stdin>"),
Self::Custom(Some(fname)) => write!(f, "{}", fname.display()),
Self::Palette(pal) => write!(f, "palette: {}", pal),
@@ -147,6 +155,7 @@ impl From<&str> for Scheme
match name {
"solarized" | "solarized_dark" | "sd" => Self::SolarizedDark,
"solarized_light" | "sl" => Self::SolarizedLight,
+ "phosphor" | "matrix" => Self::Phosphor,
"default" | "normal" => Self::Default,
path => Self::from_path(path),
}
@@ -167,6 +176,9 @@ impl From<Palette> for Scheme
if pal == Palette::from(&SOLARIZED_COLORS_LIGHT) {
return Self::SolarizedLight;
}
+ if pal == Palette::from(&MONOCHROME_PHOSPHOR) {
+ return Self::Phosphor;
+ }
Self::Palette(pal)
}
@@ -320,6 +332,7 @@ impl<'a> Job
println!("Available color schemes:");
println!(" * solarized_dark");
println!(" * solarized_light");
+ println!(" * phosphor");
println!(" * default");
}
@@ -331,6 +344,7 @@ impl<'a> Job
Scheme::SolarizedDark => Self::dump_scheme(&SOLARIZED_COLORS_DARK),
Scheme::SolarizedLight =>
Self::dump_scheme(&SOLARIZED_COLORS_LIGHT),
+ Scheme::Phosphor => Self::dump_scheme(&MONOCHROME_PHOSPHOR),
Scheme::Custom(None) => Self::dump_palette(Palette::from_stdin()),
Scheme::Custom(Some(fname)) =>
Self::dump_palette(Palette::from_file(&fname)),
@@ -447,6 +461,12 @@ static SOLARIZED_COLORS_LIGHT: RawPalette = [
"586e75", "002b36",
];
+static MONOCHROME_PHOSPHOR: RawPalette = [
+ "000000", "68fc68", "68fc68", "68fc68", "68fc68", "68fc68", "68fc68",
+ "68fc68", "68fc68", "68fc68", "68fc68", "68fc68", "68fc68", "68fc68",
+ "68fc68", "68fc68",
+];
+
static DUMMY_COLORS: RawPalette = [
"000000", "ffffff", "000000", "ffffff", "000000", "ffffff", "000000",
"ffffff", "000000", "ffffff", "000000", "ffffff", "000000", "ffffff",
@@ -628,6 +648,7 @@ impl From<&Scheme> for Palette
Scheme::Default => Self::from(&DEFAULT_COLORS),
Scheme::SolarizedDark => Self::from(&SOLARIZED_COLORS_DARK),
Scheme::SolarizedLight => Self::from(&SOLARIZED_COLORS_LIGHT),
+ Scheme::Phosphor => Self::from(&MONOCHROME_PHOSPHOR),
Scheme::Custom(None) => Self::from_stdin(),
Scheme::Custom(Some(ref fname)) => Self::from_file(fname),
Scheme::Palette(pal) => pal.clone(),