mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-25 06:19:00 +00:00
bahaghari/lib/tinted-theming: refactor
This commit is contained in:
parent
6acc1507ba
commit
61f486bd8f
@ -1,5 +1,13 @@
|
|||||||
{ pkgs, lib }:
|
{ pkgs, lib }:
|
||||||
|
|
||||||
|
let
|
||||||
|
isBaseX = i: palette:
|
||||||
|
let
|
||||||
|
paletteNames = pkgs.lib.attrNames palette;
|
||||||
|
schemeNames = builtins.map (number: "base${number}") (lib.hex.range 0 (i - 1));
|
||||||
|
in
|
||||||
|
(pkgs.lib.count (name: pkgs.lib.elem name schemeNames) paletteNames) == i;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# TODO: Return a derivation containing all of the template output from the
|
# TODO: Return a derivation containing all of the template output from the
|
||||||
# given schemes.
|
# given schemes.
|
||||||
@ -13,19 +21,8 @@
|
|||||||
|
|
||||||
# A very naive implementation of checking if a Tinted Theming scheme is a
|
# A very naive implementation of checking if a Tinted Theming scheme is a
|
||||||
# Base16 scheme.
|
# Base16 scheme.
|
||||||
isBase16 = palette:
|
isBase16 = isBaseX 16;
|
||||||
let
|
|
||||||
paletteNames = pkgs.lib.attrNames palette;
|
|
||||||
schemeNames = builtins.map (number: "base${number}") (lib.hex.range 1 16);
|
|
||||||
in
|
|
||||||
(pkgs.lib.count (name: pkgs.lib.elem name schemeNames) paletteNames) == 16;
|
|
||||||
|
|
||||||
# A very naive implementation of checking if a Tinted Theming scheme is a
|
# Same but with Base24 scheme.
|
||||||
# Base24 scheme.
|
isBase24 = isBaseX 24;
|
||||||
isBase24 = palette:
|
|
||||||
let
|
|
||||||
paletteNames = pkgs.lib.attrNames palette;
|
|
||||||
schemeNames = builtins.map (number: "base${number}") (pkgs.lib.hex.range 1 24);
|
|
||||||
in
|
|
||||||
(pkgs.lib.count (name: pkgs.lib.elem name schemeNames) paletteNames) == 24;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user