mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
Theme WIP overhaul
This commit is contained in:
parent
dc099c0d4f
commit
68594e6282
14 changed files with 341 additions and 193 deletions
|
|
@ -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; };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue