Add light theme support
This commit is contained in:
parent
2574b83cb0
commit
d1c210c494
|
@ -1 +1 @@
|
||||||
flake-profile-1-link
|
flake-profile-2-link
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/di1jdvlfxza2mnh3f0gdl8h9a5gd41yh-nix-shell-env
|
|
@ -31,6 +31,7 @@ Options:
|
||||||
--rotate-hue <ROTATE_HUE> Rotate colors along the hue axis [default: 0]
|
--rotate-hue <ROTATE_HUE> Rotate colors along the hue axis [default: 0]
|
||||||
--lighten <LIGHTEN> Lighten/darken colors [default: 0]
|
--lighten <LIGHTEN> Lighten/darken colors [default: 0]
|
||||||
--saturate <SATURATE> Saturate/desaturate colors [default: 0]
|
--saturate <SATURATE> Saturate/desaturate colors [default: 0]
|
||||||
|
-l, --light Generate a light colorscheme
|
||||||
-h, --help Print help
|
-h, --help Print help
|
||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
```
|
```
|
||||||
|
|
|
@ -73,8 +73,8 @@
|
||||||
builtins.listToAttrs (lib.lists.imap0 (i: v: {
|
builtins.listToAttrs (lib.lists.imap0 (i: v: {
|
||||||
name = builtins.toString i;
|
name = builtins.toString i;
|
||||||
value = v;
|
value = v;
|
||||||
}) (lib.strings.splitString "\n"
|
}) (lib.strings.splitString "\n" (lib.strings.removeSuffix "\n"
|
||||||
(builtins.readFile (generate name image args))));
|
(builtins.readFile (generate name image args)))));
|
||||||
in {
|
in {
|
||||||
environment.graphical.colors = lib.attrsets.mapAttrs
|
environment.graphical.colors = lib.attrsets.mapAttrs
|
||||||
(name: value: formattedColors name value.image value.params)
|
(name: value: formattedColors name value.image value.params)
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -27,6 +27,9 @@ struct Args {
|
||||||
/// Saturate/desaturate colors
|
/// Saturate/desaturate colors
|
||||||
#[arg(long, default_value_t = 0.0, value_parser = validate_color_delta, allow_hyphen_values = true)]
|
#[arg(long, default_value_t = 0.0, value_parser = validate_color_delta, allow_hyphen_values = true)]
|
||||||
saturate: f64,
|
saturate: f64,
|
||||||
|
/// Generate a light colorscheme
|
||||||
|
#[arg(short, long)]
|
||||||
|
light: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
@ -58,13 +61,18 @@ fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply color transformations, if any
|
// Apply color transformations, if any
|
||||||
let colors: Vec<_> = colors
|
let mut colors: Vec<_> = colors
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|c| c.rotate_hue(args.rotate_hue))
|
.map(|c| c.rotate_hue(args.rotate_hue))
|
||||||
.map(|c| c.lighten(args.lighten))
|
.map(|c| c.lighten(args.lighten))
|
||||||
.map(|c| c.saturate(args.saturate))
|
.map(|c| c.saturate(args.saturate))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
// Light theme transformations
|
||||||
|
if args.light {
|
||||||
|
colors.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
let brush = Brush::from_mode(Some(ansi::Mode::TrueColor));
|
let brush = Brush::from_mode(Some(ansi::Mode::TrueColor));
|
||||||
|
|
||||||
// Print colors with formatting turned off for pipes
|
// Print colors with formatting turned off for pipes
|
||||||
|
|
Loading…
Reference in New Issue