forked from balsoft/nixos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththemes.nix
executable file
·75 lines (69 loc) · 1.88 KB
/
themes.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ config, lib, pkgs, inputs, ... }:
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 = {
themes.colors = (fromBase16 (fromYAML
(builtins.readFile "${inputs.base16-unclaimed-schemes}/irblack.yaml")))
// {
alt = "#001d6c";
red = "#da1e28";
green = "#24a148";
orange = "#ff832b";
yellow = "#f1c21b";
};
};
}