more robust logic for stylix theme picking

This commit is contained in:
2025-06-08 18:10:07 -06:00
parent 0c21ba4e43
commit ceb3962833

View File

@@ -5,27 +5,63 @@
... ...
}: }:
let let
scheme = schemes.ballerinas;
cfg = config.my.stylix; cfg = config.my.stylix;
mkScheme = color: name: polarity: image: { mkScheme =
inherit name polarity image; {
iconPackage = pkgs.papirus-icon-theme.override { inherit color; }; color ? null,
base16Scheme = "${pkgs.base16-schemes}/share/themes/${name}.yaml"; name ? null,
polarity,
image,
iconPackage ? pkgs.papirus-icon-theme.override { inherit color; },
}:
{
inherit
name
polarity
image
iconPackage
;
base16Scheme = if name != null then "${pkgs.base16-schemes}/share/themes/${name}.yaml" else null;
}; };
schemes = { schemes = {
who = mkScheme "orange" "catppuccin-frappe" "dark" ./wallpapers/Nikolay_Kasatkin_Who.jpeg; who = mkScheme {
jesus = mkScheme "red" "equilibrium-light" "light" ./wallpapers/jesus.png; name = "catppuccin-frappe";
ballerinas = mkScheme "brown" "mocha" "dark" ./wallpapers/Waay-Ballerinas.jpeg; polarity = "dark";
image = ./wallpapers/Nikolay_Kasatkin_Who.jpeg;
iconPackage = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "peach";
};
};
space = mkScheme {
name = "solarflare";
color = "carmine";
polarity = "dark";
image = ./wallpapers/space.jpg;
};
jesus = mkScheme {
color = "red";
name = "equilibrium-light";
polarity = "light";
image = ./wallpapers/jesus.png;
};
ballerinas = mkScheme {
color = "brown";
name = "mocha";
polarity = "dark";
image = ./wallpapers/Waay-Ballerinas.jpeg;
};
}; };
scheme = schemes.ballerinas;
in in
{ {
options.my.stylix.enable = lib.mkEnableOption "enable"; options.my.stylix.enable = lib.mkEnableOption "enable";
config = { config = {
stylix = { stylix = {
inherit (scheme) image polarity base16Scheme; inherit (scheme) image polarity;
enable = cfg.enable; enable = cfg.enable;
targets.qt.platform = lib.mkForce "qtct"; targets.qt.platform = lib.mkForce "qtct";
}; } // lib.optionalAttrs (scheme ? base16Scheme) { inherit (scheme) base16Scheme; };
home-manager.users.jawz = { home-manager.users.jawz = {
gtk = lib.mkIf (!cfg.enable) { gtk = lib.mkIf (!cfg.enable) {
iconTheme = scheme.iconPackage; iconTheme = scheme.iconPackage;