nixconfig/modules/home/gui/theme/gtk-theme-gen.nix
soraefir 177c26e41d
Some checks failed
Nix Build / build-nixos (push) Has been cancelled
Eww Overlay
2024-04-13 10:50:02 +02:00

98 lines
3.1 KiB
Nix
Executable File

{ pkgs, config }:
let
rendersvg = pkgs.runCommand "rendersvg" { } ''
mkdir -p $out/bin
ln -s ${pkgs.resvg}/bin/resvg $out/bin/rendersvg
'';
scheme = config.colorScheme;
in pkgs.stdenv.mkDerivation rec {
name = "generated-gtk-theme-${scheme.slug}";
src = pkgs.fetchFromGitHub {
owner = "vinceliuice";
repo = "Orchis-theme";
rev = "be8b0aff92ed0741174b74c2ee10c74b15be0474";
sha256 = "sha256-m7xh/1uIDh2BM0hTPA5QymXQt6yV7mM7Ivg5VaF2PvM=";
};
nativeBuildInputs = with pkgs; [ gtk3 sassc ];
buildInputs = with pkgs; [ gnome-themes-extra ];
propagatedUserEnvPkgs = with pkgs; [ gtk-engine-murrine ];
preInstall = ''
mkdir -p $out/share/themes
cat > src/_sass/_color-palette-${scheme.slug}.scss << 'EOF'
$red-light: #${scheme.palette.base0F};
$red-dark: #${scheme.palette.base0F};
$pink-light: #${scheme.palette.base0E};
$pink-dark: #${scheme.palette.base0E};
$purple-light: #${scheme.palette.base0D};
$purple-dark: #${scheme.palette.base0D};
$blue-light: #${scheme.palette.base0C};
$blue-dark: #${scheme.palette.base0C};
$teal-light: #${scheme.palette.base0B};
$teal-dark: #${scheme.palette.base0B};
$green-light: #${scheme.palette.base0A};
$green-dark: #${scheme.palette.base0A};
$sea-light: #${scheme.palette.base0B};
$sea-dark: #${scheme.palette.base0B};
$yellow-light: #${scheme.palette.base09};
$yellow-dark: #${scheme.palette.base09};
$orange-light: #${scheme.palette.base08};
$orange-dark: #${scheme.palette.base08};
$grey-050: #${scheme.palette.base07};
$grey-100: #${scheme.palette.base07};
$grey-150: #${scheme.palette.base07};
$grey-200: #${scheme.palette.base06};
$grey-250: #${scheme.palette.base06};
$grey-300: #${scheme.palette.base05};
$grey-350: #${scheme.palette.base05};
$grey-400: #${scheme.palette.base04};
$grey-450: #${scheme.palette.base04};
$grey-500: #${scheme.palette.base03};
$grey-550: #${scheme.palette.base03};
$grey-600: #${scheme.palette.base02};
$grey-650: #${scheme.palette.base02};
$grey-700: #${scheme.palette.base01};
$grey-750: #${scheme.palette.base01};
$grey-800: #${scheme.palette.base01};
$grey-850: #${scheme.palette.base00};
$grey-900: #${scheme.palette.base00};
$grey-950: #${scheme.palette.base00};
$white: #${scheme.palette.base07};
$black: #${scheme.palette.base00};
$button-close: #${scheme.palette.base0F};
$button-max: #${scheme.palette.base0A};
$button-min: #${scheme.palette.base08};
EOF
sed -i "/\@import/s/color-palette-default/color-palette-${scheme.slug}/" src/_sass/_tweaks.scss
sed -i "/\$colorscheme:/s/default/${scheme.slug}/" src/_sass/_tweaks.scss
'';
installPhase = ''
runHook preInstall
bash install.sh -d $out/share/themes \
-t default \
-n ${scheme.slug} \
-c ${scheme.variant} \
-s standard \
--tweaks primary \
--round ${scheme.palette.border-radius}px
runHook postInstall
'';
}