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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
{ lib, themeConfig, ... }:
let
# Thank you:
# https://github.com/vedard/Arc-Theme-Generator/blob/master/arc-theme-generator.py
colorMapping = with themeConfig.colors;
with import ./theme.nix { inherit lib; };
let
hex2RgbaPrefix = color:
let rgb = hex2RGB color;
in "rgba(${toString rgb.red}, ${toString rgb.green}, ${toString rgb.blue}";
in {
"#5294e2" = dominant; # Dominant color
# Same but allows opacity
"rgba(82, 148, 226" = hex2RgbaPrefix dominant;
"#6ba4e7" = dominant; # Dominant color but in icons
# TODO: this should be slightly lighter
"#4dadd4" = dominant; # Lighter Dominant color
# Same but allows opacity
"rgba(77, 173, 212" = hex2RgbaPrefix dominant;
#"#252a35" = "#121212"; # Gnome Panel Background
#"#262932" = "#101010"; # Dark WM bordard
"#2f343f" = background0; # Dark Header BG
# Same but allows opacity
"rgba(47, 52, 63" = hex2RgbaPrefix background0; # Dark Header BG
#"#e7e8eb" = "#e8e8e8"; # Light Header BG
"#383c4a" = background; # Dark Background
# Same but allows opacity
"rgba(56, 60, 74" = hex2RgbaPrefix background;
"#d3dae3" = foreground; # Dark Foreground
# Same but allows opacity
"rgba(211, 218, 227" = hex2RgbaPrefix foreground;
"#f5f6f7" = lightBackground; # Light Background
"#3b3e45" = foreground; # Light Foreground
"#404552" = softBackground; # Dark Base Background (ListBox)
# Same but allows opacity
"rgba(64, 69, 82" = hex2RgbaPrefix softBackground;
"#3c4150" = softBackground; # Sidebars
"#353945" = softBackground; # Dark SideBar Background (Nautilus)
"rgba(53, 57, 69, 0.95)" = background2; # Nautilus SideBar
"#bac3cf" = foreground; # Dark SideBar Foreground (Nautilus)
"rgba(95, 105, 127, 0.37)" = background2; # Buttons?
"rgba(134, 144, 165, 0.37)" = background3; # Buttons? hover
"#484c59" = background2; # Popover menu button hover
# Lots of text
"rgba(207, 218, 231" = hex2RgbaPrefix foreground;
# Some more labels (list sorting)
"#b6bcc6" = dimForeground;
# Action icons
"#9699a2" = dimForeground;
# Links
"#a9caf1" = brightBlue;
# List element Hover / Selected
"#4a85cb" = dimDominant;
#"#323644" = "#202020"; # Dark Gnome Shell Modal background
# Light Gnome Shell Foreground
"#5c616c" = foreground;
"rgba(92, 97, 108" = hex2RgbaPrefix foreground;
#"#2d323d" = "#171717"; # Dark Checkbox Background
#"#5b627b" = "#505050"; # Dark Switch Background
#"#353a47" = "#232323"; # Dark Switch Circle
#"#cfd6e6" = "#dbdbdb"; # Light Switch Background
"#444a58" = background2; # Gtk2 Dark Button Background
"#505666" = background3; # Gtk2 Dark Button-Hover Background
"#3e4351" = background; # Gtk2 Dark Button-insensitive Background
"#2e3340" = background0; # Gtk2 Dark Button-active Background
# More insensitive buttons :'-(
"rgba(68, 74, 88" = hex2RgbaPrefix background0;
"#4b5162" = background; # Gtk2 Dark Tooltips Background
"#3e4350" = background0; # Gtk2 Dark Insensitive Background
#"#262934" = "#0E0E0E"; # Gtk2 Dark checkbox-unchecked border
#"#2b303b" = "#151515"; # Gtk2 Dark checkbox-unchecked Background
#"#3e434f" = "#282828"; # Gtk2 Dark scrollbar Background
#"#2d303b" = "#151515"; # Gtk2 Dark trough Background
#"#767b87" = "#606060"; # Gtk2 Dark slider Background
#"#303440" = "#191919"; # Gtk2 Dark border insensitive
#"#2b2e39" = "#131313"; # Gtk2 Dark border
"#313541" = background0; # Gtk2 Dark inline toolbar
};
#substituteArguments = with lib; concatStrings (foldAttrs (previousColor: newColor: "--replace ${previousColor} ${newColor} ") [] [colorMapping]);
substituteArguments = with lib;
concatStrings
(mapAttrsToList
(previousColor: newColor: "--replace '${previousColor}' '${newColor}' --replace '${toUpper previousColor}' '${newColor}' ")
colorMapping);
in
package:
package.overrideAttrs (oldAttrs: {
name = if (oldAttrs ? name)
then "gruvbox-${oldAttrs.name}"
else "gruvbox-${oldAttrs.pname}-${oldAttrs.version}";
postPatch = ''
# For every plaintext file
for file in $(find . -type f -exec grep -Iq . {} \; -and -print); do
substituteInPlace "$file" ${substituteArguments} 2>/dev/null
done
'';
})
|