Add colorscheme generator function
This commit is contained in:
parent
9eda1cc1f6
commit
26c36c4cc5
|
@ -0,0 +1,13 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
colorscheme = name: image: rec {
|
||||
generate = pkgs.callPackage ({ runCommand, colorz }:
|
||||
runCommand name { nativeBuildInputs = [ colorz ]; } ''
|
||||
colorz ${image} --no-preview -n 8 --bold 30 --minv 0 --maxv 255 | awk '{print $1} {print $2}' > $out
|
||||
'') { };
|
||||
|
||||
colors = builtins.listToAttrs (lib.lists.imap0 (i: v: {
|
||||
name = builtins.toString i;
|
||||
value = v;
|
||||
}) (lib.strings.splitString "\n" (builtins.readFile generate)));
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue