nixos-config/modules/themes.nix

76 lines
1.9 KiB
Nix
Raw Normal View History

2020-04-27 05:39:00 +04:00
{ config, lib, pkgs, inputs, ... }:
2020-02-17 17:00:59 +04:00
with lib;
let
colorType = types.str;
color = (name:
(mkOption {
description = "${name} color of palette";
type = colorType;
}));
fromBase16 = { base00, base01, base02, base03, base04, base05, base06, base07
, base08, base09, base0A, base0B, base0C, base0D, base0E, base0F, ... }:
builtins.mapAttrs (_: v: "#" + v) {
bg = base00;
fg = base07;
gray = base03;
alt = base02;
dark = base01;
red = base08;
orange = base09;
yellow = base0A;
green = base0B;
cyan = base0C;
blue = base0D;
purple = base0E;
};
fromYAML = yaml:
builtins.fromJSON (builtins.readFile (pkgs.stdenv.mkDerivation {
name = "fromYAML";
phases = [ "buildPhase" ];
buildPhase = "echo '${yaml}' | ${pkgs.yaml2json}/bin/yaml2json > $out";
}));
in {
options = {
themes = {
colors = mkOption {
description =
"Set of colors from which the themes for various applications will be generated";
type = with types;
submodule {
options = {
bg = color "background";
fg = color "foreground";
gray = color "gray";
alt = color "alternative";
dark = color "darker";
blue = color "blue";
green = color "green";
red = color "red";
orange = color "orange";
yellow = color "yellow";
cyan = color "cyan";
purple = color "purple";
};
};
};
};
};
config = {
2020-06-13 00:12:36 +04:00
themes.colors = (fromBase16 (fromYAML
(builtins.readFile "${inputs.base16-unclaimed-schemes}/irblack.yaml")))
// {
alt = "#001d6c";
red = "#da1e28";
green = "#24a148";
orange = "#ff832b";
yellow = "#f1c21b";
};
2020-02-17 17:00:59 +04:00
};
}