{vencord,vesktop}: support fonts without IFD (#846)

Restores commit be606eaa87
after it was reverted in e72aa84da1,
with an alternative implementation which doesn't require
import-from-derivation.
This commit is contained in:
Flameopathic 2025-02-10 06:18:14 -05:00 committed by GitHub
parent 2c1d493c5f
commit eb5f817567
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 80 additions and 70 deletions

View file

@ -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;
};
}

View file

@ -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;
}

View file

@ -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;
}
''

View file

@ -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;
})
]
);