mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
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:
parent
fa4f112505
commit
4fddb23df3
13 changed files with 433 additions and 18 deletions
19
lib/colorhelpers.nix
Normal file
19
lib/colorhelpers.nix
Normal 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)"
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue