From 9f0cdf9f98f0d12782d5244a83a2b9da5f253cd5 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Fri, 20 Dec 2024 09:20:19 +0100 Subject: [PATCH] nixosModules/style: use with cfg.scheme.palette; when declaring colors --- shared/nixosModules/style/modules/discord.nix | 5 +- shared/nixosModules/style/modules/foot.nix | 53 ++--- shared/nixosModules/style/modules/fuzzel.nix | 16 +- shared/nixosModules/style/modules/gtk.nix | 1 - .../nixosModules/style/modules/hyprlock.nix | 182 +++++++++--------- .../nixosModules/style/modules/swaylock.nix | 66 +++---- shared/nixosModules/style/modules/waybar.nix | 36 ++-- 7 files changed, 181 insertions(+), 178 deletions(-) diff --git a/shared/nixosModules/style/modules/discord.nix b/shared/nixosModules/style/modules/discord.nix index 93e1a7d..7c649bc 100644 --- a/shared/nixosModules/style/modules/discord.nix +++ b/shared/nixosModules/style/modules/discord.nix @@ -4,11 +4,10 @@ ... }: let cfg = config.local.style; - inherit (cfg) scheme; in { config.home-manager.sharedModules = lib.mkIf cfg.enable [ { - xdg.configFile."equibop/themes/midnight-base16.css".text = with scheme.palette; '' + xdg.configFile."equibop/themes/midnight-base16.css".text = with cfg.scheme.palette; '' /** * @name Midnight-base16 * @description A dark, rounded discord theme. Updated to use base16 colors. @@ -31,7 +30,7 @@ in { --font: 'gg sans'; /* top left corner text */ - --corner-text: '${scheme.name}'; + --corner-text: '${cfg.scheme.name}'; /* color of status indicators and window controls */ --online-indicator: ${base0B}; /* change to #23a55a for default green */ diff --git a/shared/nixosModules/style/modules/foot.nix b/shared/nixosModules/style/modules/foot.nix index d7ab1a7..d35e4ae 100644 --- a/shared/nixosModules/style/modules/foot.nix +++ b/shared/nixosModules/style/modules/foot.nix @@ -10,35 +10,36 @@ in { programs.foot.settings.colors = let # because someone thought this was a great idea: https://github.com/tinted-theming/schemes/commit/61058a8d2e2bd4482b53d57a68feb56cdb991f0b palette = builtins.mapAttrs (_: color: lib.removePrefix "#" color) cfg.scheme.palette; - in { - background = palette.base00; - foreground = palette.base05; + in + with palette; { + background = base00; + foreground = base05; - regular0 = palette.base00; - regular1 = palette.base08; - regular2 = palette.base0B; - regular3 = palette.base0A; - regular4 = palette.base0D; - regular5 = palette.base0E; - regular6 = palette.base0C; - regular7 = palette.base05; + regular0 = base00; + regular1 = base08; + regular2 = base0B; + regular3 = base0A; + regular4 = base0D; + regular5 = base0E; + regular6 = base0C; + regular7 = base05; - bright0 = palette.base02; - bright1 = palette.base08; - bright2 = palette.base0B; - bright3 = palette.base0A; - bright4 = palette.base0D; - bright5 = palette.base0E; - bright6 = palette.base0C; - bright7 = palette.base07; + bright0 = base02; + bright1 = base08; + bright2 = base0B; + bright3 = base0A; + bright4 = base0D; + bright5 = base0E; + bright6 = base0C; + bright7 = base07; - "16" = palette.base09; - "17" = palette.base0F; - "18" = palette.base01; - "19" = palette.base02; - "20" = palette.base04; - "21" = palette.base06; - }; + "16" = base09; + "17" = base0F; + "18" = base01; + "19" = base02; + "20" = base04; + "21" = base06; + }; } ]; } diff --git a/shared/nixosModules/style/modules/fuzzel.nix b/shared/nixosModules/style/modules/fuzzel.nix index 8c2b8d7..2cdf86a 100644 --- a/shared/nixosModules/style/modules/fuzzel.nix +++ b/shared/nixosModules/style/modules/fuzzel.nix @@ -12,14 +12,14 @@ in { main = { font = "sans-serif:size=16"; }; - colors = { - background = "${scheme.palette.base01}f2"; - text = "${scheme.palette.base05}ff"; - match = "${scheme.palette.base0E}ff"; - selection = "${scheme.palette.base03}ff"; - selection-text = "${scheme.palette.base06}ff"; - selection-match = "${scheme.palette.base0E}ff"; - border = "${scheme.palette.base0E}ff"; + colors = with scheme.palette; { + background = "${base01}f2"; + text = "${base05}ff"; + match = "${base0E}ff"; + selection = "${base03}ff"; + selection-text = "${base06}ff"; + selection-match = "${base0E}ff"; + border = "${base0E}ff"; }; }; } diff --git a/shared/nixosModules/style/modules/gtk.nix b/shared/nixosModules/style/modules/gtk.nix index 2bce480..7320c3c 100644 --- a/shared/nixosModules/style/modules/gtk.nix +++ b/shared/nixosModules/style/modules/gtk.nix @@ -1,7 +1,6 @@ { lib, config, - scheme, ... }: let cfg = config.local.style; diff --git a/shared/nixosModules/style/modules/hyprlock.nix b/shared/nixosModules/style/modules/hyprlock.nix index 6e7282f..d2c48e2 100644 --- a/shared/nixosModules/style/modules/hyprlock.nix +++ b/shared/nixosModules/style/modules/hyprlock.nix @@ -5,101 +5,105 @@ ... }: let cfg = config.local.style; - inherit (cfg) scheme; - rgbaPalette = builtins.mapAttrs (_: c: (lib'.rgba c 1)) scheme.palette; + + # hyprlock takes colors such as rgb[a](r, g, b [, a]) + rgbaPalette = builtins.mapAttrs (_: c: (lib'.rgba c 1)) cfg.scheme.palette; in { - config.home-manager.sharedModules = lib.mkIf cfg.enable [ - { - programs.hyprlock = { - settings = { - background = [ - { - path = "screenshot"; - blur_passes = 3; - blur_size = 8; - } - ]; + config.home-manager.sharedModules = with rgbaPalette; + lib.mkIf cfg.enable [ + { + programs.hyprlock = { + settings = { + background = [ + { + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + } + ]; - general = { - disable_loading_bar = true; - hide_cursor = true; - }; + general = { + disable_loading_bar = true; + hide_cursor = true; + }; - label = [ - { + label = [ + { + monitor = ""; + text = "Layout: $LAYOUT"; + font_size = 25; + color = base05; + + position = "30, -30"; + halign = "left"; + valign = "top"; + } + { + monitor = ""; + text = "$TIME"; + font_size = 90; + color = base05; + + position = "-30, 0"; + halign = "right"; + valign = "top"; + } + { + monitor = ""; + text = "cmd[update:43200000] date +\"%A, %d %B %Y\""; + font_size = 25; + color = base05; + + position = "-30, -150"; + halign = "right"; + valign = "top"; + } + ]; + + image = { monitor = ""; - text = "Layout: $LAYOUT"; - font_size = 25; - color = rgbaPalette.base05; + path = "${cfg.avatar}"; # Replace with your avatar path + size = 100; + border_color = base0D; - position = "30, -30"; - halign = "left"; - valign = "top"; - } - { - monitor = ""; - text = "$TIME"; - font_size = 90; - color = rgbaPalette.base05; - - position = "-30, 0"; - halign = "right"; - valign = "top"; - } - { - monitor = ""; - text = "cmd[update:43200000] date +\"%A, %d %B %Y\""; - font_size = 25; - color = rgbaPalette.base05; - - position = "-30, -150"; - halign = "right"; - valign = "top"; - } - ]; - - image = { - monitor = ""; - path = "${cfg.avatar}"; # Replace with your avatar path - size = 100; - border_color = rgbaPalette.base0D; - - position = "0, 75"; - halign = "center"; - valign = "center"; - }; - - input-field = [ - { - monitor = ""; - - size = "300, 60"; - outline_thickness = 4; - dots_size = 0.2; - dots_spacing = 0.2; - dots_center = true; - - outer_color = rgbaPalette.base0D; - inner_color = rgbaPalette.base02; - font_color = rgbaPalette.base05; - - fade_on_empty = false; - placeholder_text = "󰌾 Logged in as $USER"; - - hide_input = false; - check_color = rgbaPalette.base0D; - fail_color = rgbaPalette.base08; - - fail_text = "$FAIL ($ATTEMPTS)"; - capslock_color = rgbaPalette.base0E; - - position = "0, -47"; + position = "0, 75"; halign = "center"; valign = "center"; - } - ]; + }; + + input-field = [ + { + monitor = ""; + + size = "300, 60"; + outline_thickness = 4; + dots_size = 0.2; + dots_spacing = 0.2; + dots_center = true; + + outer_color = base0D; + inner_color = base02; + font_color = base05; + + fade_on_empty = false; + + # the span elements still use #RRGGBB, so we use scheme directly + placeholder_text = "󰌾 Logged in as $USER"; + + hide_input = false; + check_color = base0D; + fail_color = base08; + + fail_text = "$FAIL ($ATTEMPTS)"; + capslock_color = base0E; + + position = "0, -47"; + halign = "center"; + valign = "center"; + } + ]; + }; }; - }; - } - ]; + } + ]; } diff --git a/shared/nixosModules/style/modules/swaylock.nix b/shared/nixosModules/style/modules/swaylock.nix index ec1d416..b5e13c7 100644 --- a/shared/nixosModules/style/modules/swaylock.nix +++ b/shared/nixosModules/style/modules/swaylock.nix @@ -4,44 +4,44 @@ ... }: let cfg = config.local.style; - inherit (cfg) scheme; in { - config.home-manager.sharedModules = lib.mkIf cfg.enable [ - { - programs.swaylock.settings = { - inside-color = scheme.palette.base01; - line-color = scheme.palette.base01; - ring-color = scheme.palette.base05; - text-color = scheme.palette.base05; + config.home-manager.sharedModules = with cfg.scheme.palette; + lib.mkIf cfg.enable [ + { + programs.swaylock.settings = { + inside-color = base01; + line-color = base01; + ring-color = base05; + text-color = base05; - inside-clear-color = scheme.palette.base0A; - line-clear-color = scheme.palette.base0A; - ring-clear-color = scheme.palette.base00; - text-clear-color = scheme.palette.base00; + inside-clear-color = base0A; + line-clear-color = base0A; + ring-clear-color = base00; + text-clear-color = base00; - inside-caps-lock-color = scheme.palette.base03; - line-caps-lock-color = scheme.palette.base03; - ring-caps-lock-color = scheme.palette.base00; - text-caps-lock-color = scheme.palette.base00; + inside-caps-lock-color = base03; + line-caps-lock-color = base03; + ring-caps-lock-color = base00; + text-caps-lock-color = base00; - inside-ver-color = scheme.palette.base0D; - line-ver-color = scheme.palette.base0D; - ring-ver-color = scheme.palette.base00; - text-ver-color = scheme.palette.base00; + inside-ver-color = base0D; + line-ver-color = base0D; + ring-ver-color = base00; + text-ver-color = base00; - inside-wrong-color = scheme.palette.base08; - line-wrong-color = scheme.palette.base08; - ring-wrong-color = scheme.palette.base00; - text-wrong-color = scheme.palette.base00; + inside-wrong-color = base08; + line-wrong-color = base08; + ring-wrong-color = base00; + text-wrong-color = base00; - caps-lock-bs-hl-color = scheme.palette.base08; - caps-lock-key-hl-color = scheme.palette.base0D; - bs-hl-color = scheme.palette.base08; - key-hl-color = scheme.palette.base0D; + caps-lock-bs-hl-color = base08; + caps-lock-key-hl-color = base0D; + bs-hl-color = base08; + key-hl-color = base0D; - separator-color = "#00000000"; # transparent - layout-bg-color = "#00000050"; # semi-transparent black - }; - } - ]; + separator-color = "#00000000"; # transparent + layout-bg-color = "#00000050"; # semi-transparent black + }; + } + ]; } diff --git a/shared/nixosModules/style/modules/waybar.nix b/shared/nixosModules/style/modules/waybar.nix index 72bdb13..2c72e99 100644 --- a/shared/nixosModules/style/modules/waybar.nix +++ b/shared/nixosModules/style/modules/waybar.nix @@ -8,7 +8,7 @@ in { config.home-manager.sharedModules = lib.mkIf cfg.enable [ { - programs.waybar.style = '' + programs.waybar.style = with cfg.scheme.palette; '' * { font-family: "0xProto Nerd Font"; font-size: 16px; @@ -20,8 +20,8 @@ in { background: rgba(0,0,0,0); } #workspaces { - color: ${cfg.scheme.palette.base00}; - background: ${cfg.scheme.palette.base01}; + color: ${base00}; + background: ${base01}; margin: 4px 4px; padding: 5px 5px; border-radius: 16px; @@ -31,8 +31,8 @@ in { padding: 0px 5px; margin: 0px 3px; border-radius: 16px; - color: ${cfg.scheme.palette.base00}; - background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D}); + color: ${base00}; + background: linear-gradient(45deg, ${base08}, ${base0D}); opacity: 0.5; transition: ${betterTransition}; } @@ -41,8 +41,8 @@ in { padding: 0px 5px; margin: 0px 3px; border-radius: 16px; - color: ${cfg.scheme.palette.base00}; - background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D}); + color: ${base00}; + background: linear-gradient(45deg, ${base08}, ${base0D}); transition: ${betterTransition}; opacity: 1.0; min-width: 40px; @@ -50,33 +50,33 @@ in { #workspaces button:hover { font-weight: bold; border-radius: 16px; - color: ${cfg.scheme.palette.base00}; - background: linear-gradient(45deg, ${cfg.scheme.palette.base08}, ${cfg.scheme.palette.base0D}); + color: ${base00}; + background: linear-gradient(45deg, ${base08}, ${base0D}); opacity: 0.8; transition: ${betterTransition}; } tooltip { - background: ${cfg.scheme.palette.base00}; - border: 1px solid ${cfg.scheme.palette.base08}; + background: ${base00}; + border: 1px solid ${base08}; border-radius: 12px; } tooltip label { - color: ${cfg.scheme.palette.base08}; + color: ${base08}; } #window, #pulseaudio, #cpu, #memory, #idle_inhibitor { font-weight: bold; margin: 4px 0px; margin-left: 7px; padding: 0px 18px; - background: ${cfg.scheme.palette.base00}; - color: ${cfg.scheme.palette.base05}; + background: ${base00}; + color: ${base05}; border-radius: 24px 10px 24px 10px; } #network, #battery, #custom-swaync, #tray, #custom-power { font-weight: bold; - background: ${cfg.scheme.palette.base00}; - color: ${cfg.scheme.palette.base05}; + background: ${base00}; + color: ${base05}; margin: 4px 0px; margin-right: 7px; border-radius: 10px 24px 10px 24px; @@ -84,8 +84,8 @@ in { } #clock { font-weight: bold; - color: ${cfg.scheme.palette.base00}; - background: linear-gradient(90deg, ${cfg.scheme.palette.base0E}, ${cfg.scheme.palette.base0C}); + color: ${base00}; + background: linear-gradient(90deg, ${base0E}, ${base0C}); margin: 0px; padding: 0px 15px 0px 30px; border-radius: 0px 0px 0px 40px;