Theme WIP overhaul

This commit is contained in:
kat witch 2021-08-26 18:26:57 +01:00
parent dc099c0d4f
commit 68594e6282
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
14 changed files with 341 additions and 193 deletions

View file

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, pkgs, lib, ... }:
/*
This module:
@ -7,12 +7,20 @@
with lib;
let cfg = config.kw; in
let cfg = config.kw.theme; in
{
options.kw = {
hexColors = mkOption {
options.kw.theme = {
enable = mkEnableOption "kat's theme module";
css_style = mkOption {
type = types.enum [ "nested" "compressed" "compact" "expanded" ];
default = "expanded";
};
base16 = mkOption {
type = types.attrsOf types.str;
};
alpha = mkOption {
type = types.str;
};
font = {
name = mkOption {
type = types.str;
@ -28,4 +36,26 @@ let cfg = config.kw; in
};
};
};
config = mkIf (cfg.enable) {
kw.theme = {
base16 = lib.mapAttrs' (k: v: lib.nameValuePair k "#${v.hex.rgb}")
(lib.filterAttrs (n: _: lib.hasInfix "base" n) config.lib.arc.base16.schemeForAlias.default);
alpha = "80";
};
lib.kw.sassTemplate = pkgs.callPackage ({ sass, stdenv }: { name, src }: stdenv.mkDerivation ({
inherit name src;
nativeBuildInputs = lib.singleton sass;
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src sub.sass
sass sub.sass $out --sourcemap=none --style=${cfg.css_style}
'';
} // cfg.base16 // {
font = cfg.font.name;
font_size = cfg.font.size_css;
inherit (cfg) alpha;
})) {};
_module.args = { inherit (config.lib) kw; };
};
}