emacs, waybar, wallpapers.

Moved to doom emacs. Changed wallpapers. hextorgba working. Waybar now
uses nix templated CSS pulling from colors.nix.
This commit is contained in:
kat witch 2021-02-08 21:47:29 +00:00 committed by kat
parent fa4f112505
commit 4fddb23df3
13 changed files with 433 additions and 18 deletions

19
lib/colorhelpers.nix Normal file
View file

@ -0,0 +1,19 @@
{ lib }:
rec {
hexChars = [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f" ];
hexCharToInt = char: let
pairs = lib.imap0 (lib.flip lib.nameValuePair) hexChars;
idx = builtins.listToAttrs pairs;
in idx.${lib.toLower char};
hexToInt = str:
lib.foldl (value: chr: value * 16 + hexCharToInt chr) 0 (lib.stringToCharacters str);
hextorgba = hex: (
let r_hex = lib.substring 1 2 hex;
g_hex = lib.substring 3 2 hex;
b_hex = lib.substring 5 2 hex;
r_dec = hexToInt r_hex;
g_dec = hexToInt g_hex;
b_dec = hexToInt b_hex;
in "rgba(${toString r_dec}, ${toString g_dec}, ${toString b_dec}, 0.75)"
);
}