Add light theme support

This commit is contained in:
Agatha Lovelace 2023-06-08 12:35:07 +02:00
parent 2574b83cb0
commit d1c210c494
Signed by: sorceress
GPG Key ID: 01D0B3AB10CED4F8
5 changed files with 14 additions and 4 deletions

View File

@ -1 +1 @@
flake-profile-1-link
flake-profile-2-link

View File

@ -0,0 +1 @@
/nix/store/di1jdvlfxza2mnh3f0gdl8h9a5gd41yh-nix-shell-env

View File

@ -31,6 +31,7 @@ Options:
--rotate-hue <ROTATE_HUE> Rotate colors along the hue axis [default: 0]
--lighten <LIGHTEN> Lighten/darken colors [default: 0]
--saturate <SATURATE> Saturate/desaturate colors [default: 0]
-l, --light Generate a light colorscheme
-h, --help Print help
-V, --version Print version
```

View File

@ -73,8 +73,8 @@
builtins.listToAttrs (lib.lists.imap0 (i: v: {
name = builtins.toString i;
value = v;
}) (lib.strings.splitString "\n"
(builtins.readFile (generate name image args))));
}) (lib.strings.splitString "\n" (lib.strings.removeSuffix "\n"
(builtins.readFile (generate name image args)))));
in {
environment.graphical.colors = lib.attrsets.mapAttrs
(name: value: formattedColors name value.image value.params)

View File

@ -27,6 +27,9 @@ struct Args {
/// Saturate/desaturate colors
#[arg(long, default_value_t = 0.0, value_parser = validate_color_delta, allow_hyphen_values = true)]
saturate: f64,
/// Generate a light colorscheme
#[arg(short, long)]
light: bool,
}
fn main() -> Result<()> {
@ -58,13 +61,18 @@ fn main() -> Result<()> {
}
// Apply color transformations, if any
let colors: Vec<_> = colors
let mut colors: Vec<_> = colors
.into_iter()
.map(|c| c.rotate_hue(args.rotate_hue))
.map(|c| c.lighten(args.lighten))
.map(|c| c.saturate(args.saturate))
.collect();
// Light theme transformations
if args.light {
colors.reverse();
}
let brush = Brush::from_mode(Some(ansi::Mode::TrueColor));
// Print colors with formatting turned off for pipes