From eb5f81756731a3eefa42b1caf494ba5a9c8aedb4 Mon Sep 17 00:00:00 2001 From: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Date: Mon, 10 Feb 2025 06:18:14 -0500 Subject: [PATCH] {vencord,vesktop}: support fonts without IFD (#846) Restores commit be606eaa87dfcf22c98f80453b42ec40dcbcdf36 after it was reverted in e72aa84da1c6982c11620a4154ded8c603f33f46, with an alternative implementation which doesn't require import-from-derivation. --- modules/vencord/hm.nix | 12 +++--- modules/vencord/template.mustache | 58 ---------------------------- modules/vencord/template.nix | 64 +++++++++++++++++++++++++++++++ modules/vesktop/hm.nix | 16 ++++---- 4 files changed, 80 insertions(+), 70 deletions(-) delete mode 100644 modules/vencord/template.mustache create mode 100644 modules/vencord/template.nix diff --git a/modules/vencord/hm.nix b/modules/vencord/hm.nix index 8252c49b..ceb66120 100644 --- a/modules/vencord/hm.nix +++ b/modules/vencord/hm.nix @@ -1,9 +1,11 @@ { config, lib, ... }: let - themeFile = config.lib.stylix.colors { - template = ./template.mustache; - extension = ".css"; - }; + template = + let + inherit (config.lib.stylix) colors; + inherit (config.stylix) fonts; + in + import ./template.nix { inherit colors fonts; }; in { options.stylix.targets.vencord.enable = @@ -12,6 +14,6 @@ in config = lib.mkIf (config.stylix.enable && config.stylix.targets.vencord.enable) { - xdg.configFile."Vencord/themes/stylix.theme.css".source = themeFile; + xdg.configFile."Vencord/themes/stylix.theme.css".text = template; }; } diff --git a/modules/vencord/template.mustache b/modules/vencord/template.mustache deleted file mode 100644 index 2a068cf1..00000000 --- a/modules/vencord/template.mustache +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @name Stylix -* @author Stylix -* @version 0.0.0 -* @description Theme configured via NixOS or Home Manager. -**/ - -:root { - --base00: #{{base00-hex}}; /* Black */ - --base01: #{{base01-hex}}; /* Bright Black */ - --base02: #{{base02-hex}}; /* Grey */ - --base03: #{{base03-hex}}; /* Brighter Grey */ - --base04: #{{base04-hex}}; /* Bright Grey */ - --base05: #{{base05-hex}}; /* White */ - --base06: #{{base06-hex}}; /* Brighter White */ - --base07: #{{base07-hex}}; /* Bright White */ - --base08: #{{base08-hex}}; /* Red */ - --base09: #{{base09-hex}}; /* Orange */ - --base0A: #{{base0A-hex}}; /* Yellow */ - --base0B: #{{base0B-hex}}; /* Green */ - --base0C: #{{base0C-hex}}; /* Cyan */ - --base0D: #{{base0D-hex}}; /* Blue */ - --base0E: #{{base0E-hex}}; /* Purple */ - --base0F: #{{base0F-hex}}; /* Magenta */ - - --primary-630: var(--base00); /* Autocomplete background */ - --primary-660: var(--base00); /* Search input background */ -} - -.theme-light, .theme-dark { - --search-popout-option-fade: none; /* Disable fade for search popout */ - --bg-overlay-2: var(--base00); /* These 2 are needed for proper threads coloring */ - --home-background: var(--base00); - --bg-overlay-chat : var(--base00); /* Recolor forum channels */ - --background-primary: var(--base00); - --background-secondary: var(--base01); - --background-secondary-alt: var(--base01); - --channeltextarea-background: var(--base01); - --background-tertiary: var(--base00); - --background-accent: var(--base0E); - --background-floating: var(--base01); - --background-modifier-hover: #{{base00-hex}}4c; /* 30% of base00 */ - --background-modifier-selected: var(--base00); - --text-normal: var(--base05); - --text-secondary: var(--base03); - --text-muted: var(--base04); - --text-link: var(--base0C); - --interactive-normal: var(--base05); - --interactive-hover: var(--base05); - --interactive-active: var(--base07); - --interactive-muted: var(--base03); - --channels-default: var(--base04); - --channel-icon: var(--base04); - --header-primary: var(--base06); - --header-secondary: var(--base04); - --scrollbar-thin-track: transparent; - --scrollbar-auto-track: transparent; -} diff --git a/modules/vencord/template.nix b/modules/vencord/template.nix new file mode 100644 index 00000000..5fe77b41 --- /dev/null +++ b/modules/vencord/template.nix @@ -0,0 +1,64 @@ +{ colors, fonts }: +'' + /** + * @name Stylix + * @author Stylix + * @version 0.0.0 + * @description Theme configured via NixOS or Home Manager. + **/ + + :root { + --font-primary: ${fonts.sansSerif.name}; + --font-display: ${fonts.sansSerif.name}; + --font-code: ${fonts.monospace.name}; + --base00: #${colors.base00}; /* Black */ + --base01: #${colors.base01}; /* Bright Black */ + --base02: #${colors.base02}; /* Grey */ + --base03: #${colors.base03}; /* Brighter Grey */ + --base04: #${colors.base04}; /* Bright Grey */ + --base05: #${colors.base05}; /* White */ + --base06: #${colors.base06}; /* Brighter White */ + --base07: #${colors.base07}; /* Bright White */ + --base08: #${colors.base08}; /* Red */ + --base09: #${colors.base09}; /* Orange */ + --base0A: #${colors.base0A}; /* Yellow */ + --base0B: #${colors.base0B}; /* Green */ + --base0C: #${colors.base0C}; /* Cyan */ + --base0D: #${colors.base0D}; /* Blue */ + --base0E: #${colors.base0E}; /* Purple */ + --base0F: #${colors.base0F}; /* Magenta */ + + --primary-630: var(--base00); /* Autocomplete background */ + --primary-660: var(--base00); /* Search input background */ + } + + .theme-light, .theme-dark { + --search-popout-option-fade: none; /* Disable fade for search popout */ + --bg-overlay-2: var(--base00); /* These 2 are needed for proper threads coloring */ + --home-background: var(--base00); + --bg-overlay-chat : var(--base00); /* Recolor forum channels */ + --background-primary: var(--base00); + --background-secondary: var(--base01); + --background-secondary-alt: var(--base01); + --channeltextarea-background: var(--base01); + --background-tertiary: var(--base00); + --background-accent: var(--base0E); + --background-floating: var(--base01); + --background-modifier-hover: #{{base00-hex}}4c; /* 30% of base00 */ + --background-modifier-selected: var(--base00); + --text-normal: var(--base05); + --text-secondary: var(--base03); + --text-muted: var(--base04); + --text-link: var(--base0C); + --interactive-normal: var(--base05); + --interactive-hover: var(--base05); + --interactive-active: var(--base07); + --interactive-muted: var(--base03); + --channels-default: var(--base04); + --channel-icon: var(--base04); + --header-primary: var(--base06); + --header-secondary: var(--base04); + --scrollbar-thin-track: transparent; + --scrollbar-auto-track: transparent; + } +'' diff --git a/modules/vesktop/hm.nix b/modules/vesktop/hm.nix index 997f6a98..90b7e180 100644 --- a/modules/vesktop/hm.nix +++ b/modules/vesktop/hm.nix @@ -5,10 +5,12 @@ ... }: let - themeFile = config.lib.stylix.colors { - template = ../vencord/template.mustache; - extension = ".css"; - }; + template = + let + inherit (config.lib.stylix) colors; + inherit (config.stylix) fonts; + in + import ../vencord/template.nix { inherit colors fonts; }; in { options.stylix.targets.vesktop.enable = @@ -19,12 +21,12 @@ in ( lib.mkMerge [ (lib.mkIf pkgs.stdenv.hostPlatform.isLinux { - xdg.configFile."vesktop/themes/stylix.theme.css".source = themeFile; + xdg.configFile."vesktop/themes/stylix.theme.css".text = template; }) (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { - home.file."Library/Application Support/vesktop/themes/stylix.theme.css".source = - themeFile; + home.file."Library/Application Support/vesktop/themes/stylix.theme.css".text = + template; }) ] );