diff --git a/.direnv/flake-profile b/.direnv/flake-profile index 0c05709..c7ae5b7 120000 --- a/.direnv/flake-profile +++ b/.direnv/flake-profile @@ -1 +1 @@ -flake-profile-1-link \ No newline at end of file +flake-profile-2-link \ No newline at end of file diff --git a/.direnv/flake-profile-2-link b/.direnv/flake-profile-2-link new file mode 120000 index 0000000..98d03da --- /dev/null +++ b/.direnv/flake-profile-2-link @@ -0,0 +1 @@ +/nix/store/di1jdvlfxza2mnh3f0gdl8h9a5gd41yh-nix-shell-env \ No newline at end of file diff --git a/README.md b/README.md index f23db2d..84ef0f6 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Options: --rotate-hue Rotate colors along the hue axis [default: 0] --lighten Lighten/darken colors [default: 0] --saturate Saturate/desaturate colors [default: 0] + -l, --light Generate a light colorscheme -h, --help Print help -V, --version Print version ``` diff --git a/flake.nix b/flake.nix index faf8c60..b5a21ac 100644 --- a/flake.nix +++ b/flake.nix @@ -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) diff --git a/src/main.rs b/src/main.rs index 28bb0dd..bed141c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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