mirror of
https://github.com/RGBCube/ThemeNix
synced 2025-07-28 08:57:46 +00:00
Only add prefix if field is a valid color
This commit is contained in:
parent
fc43add106
commit
de638a3a6f
1 changed files with 7 additions and 4 deletions
11
flake.nix
11
flake.nix
|
@ -3,14 +3,17 @@
|
||||||
|
|
||||||
outputs = { self }: let
|
outputs = { self }: let
|
||||||
raw = import ./themes.nix;
|
raw = import ./themes.nix;
|
||||||
|
|
||||||
|
isValidColor = thing: if builtins.isString thing then
|
||||||
|
(builtins.match "^[0-9a-fA-F]{6}" thing) != null
|
||||||
|
else
|
||||||
|
false;
|
||||||
in {
|
in {
|
||||||
inherit raw;
|
inherit raw;
|
||||||
|
|
||||||
custom = theme: let
|
custom = theme: let
|
||||||
onlyColors = builtins.removeAttrs theme [ "name" "author" ];
|
with0x = theme // (builtins.mapAttrs (_: value: if isValidColor value then "0x" + value else value) theme);
|
||||||
|
withHashtag = theme // (builtins.mapAttrs (_: value: if isValidColor value then "#" + value else value) theme);
|
||||||
with0x = theme // (builtins.mapAttrs (_: value: "0x" + value) onlyColors);
|
|
||||||
withHashtag = theme // (builtins.mapAttrs (_: value: "#" + value) onlyColors);
|
|
||||||
|
|
||||||
themeFull = theme // {
|
themeFull = theme // {
|
||||||
inherit with0x withHashtag;
|
inherit with0x withHashtag;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue