Compare commits

...

6 Commits

Author SHA1 Message Date
f8cf5b8ec8 use hm module for matugen 2024-04-30 00:01:38 +02:00
1328a8b94c feat: readme 2024-04-29 21:35:33 +02:00
b6856413b2 feat: add theme readme 2024-04-29 21:27:31 +02:00
aa46f5f083 feat: more stuff 2024-04-29 21:10:50 +02:00
1ca4663d76 feat: better theming 2024-04-29 21:09:34 +02:00
43ca38910c refactor: remove darkman 2024-04-29 20:34:10 +02:00
18 changed files with 521 additions and 365 deletions

8
flake.lock generated
View File

@@ -220,16 +220,16 @@
"systems": "systems"
},
"locked": {
"lastModified": 1714402324,
"narHash": "sha256-VVT4K/r7REVT1g/UF7xgpCuR9h61q9KG1KW1BbbT7YA=",
"lastModified": 1714427480,
"narHash": "sha256-m6iICMLTIfcD6BQMR03Y946f+tmb6pseew+ZVwqY/YI=",
"owner": "Theaninova",
"repo": "matugen",
"rev": "6bbb7a6e8047f27c35f6c69b8de1c3a59b87b6cd",
"rev": "1d4cb4ee1b407df5cb9eec89e54a8e9912ea5a5b",
"type": "github"
},
"original": {
"owner": "Theaninova",
"ref": "custom-color-support",
"ref": "add-home-manager-module",
"repo": "matugen",
"type": "github"
}

View File

@@ -6,7 +6,7 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
matugen.url = "github:Theaninova/matugen/custom-color-support";
matugen.url = "github:Theaninova/matugen/add-home-manager-module";
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
@@ -46,7 +46,6 @@
matugen = matugen.packages.${prev.system}.default;
gbmonctl = prev.callPackage ./overlays/gbmonctl { };
lpc21isp = prev.callPackage ./overlays/lpc21isp { };
darkman = prev.callPackage ./overlays/darkman { };
cura = prev.callPackage ./overlays/cura { };
})
];
@@ -78,6 +77,7 @@
};
users.${username} = {
imports = [
matugen.homeManagerModules.default
./modules/home-manager
./hosts/${hostname}/home.nix
];

View File

@@ -49,7 +49,6 @@
};
};
theming.md3-evo.enable = true;
shell.components = {
waybar.enable = true;
dunst.enable = true;

View File

@@ -1 +1,4 @@
{ ... }: { }
{ ... }:
{
theme.md3-evo.enable = true;
}

View File

@@ -18,6 +18,7 @@
./packages
./programs
./services
./theme/md3-evo.nix
./desktops/hyprland
];
}

View File

@@ -0,0 +1,90 @@
# MD3 Evo Theming
MD3 Evo is a theming system derived from the Material Design 3 color sytem.
<div>
<img src="./dark.png">
<img src="./light.png">
</div>
## Features
- Wallpaper colors
- Dynamic color and dark mode switching at runtime (no `nixos-rebuild`)
- Dark and light mode support
- User contrast options
- Color flavours
- Faithful ANSI colors that still adapt to your theme
- Static syntax highlighting colors that blends with your theme
- Customizable syntax highlighting tokens
- Transparency and blur support
## CLI Usage
```sh
# Open wallpaper picker
theme wallpaper
# Set wallpaper by path
theme wallpaper ~/Pictures/wallpaper.png
# Switch theme
theme toggle
theme light
theme dark
# Get current theme
theme mode
```
## Integrations
| Name | Status | Comment |
| -------- | ------ | ------------------------------------------------------------------------------- |
| Neovim | ✅ | |
| Hyprland | ✅ | |
| Kitty | ✅ | Missing some parts I don't use. Transparency is tinted weirdly for some reason. |
| Anyrun | ✅ | |
| Vesktop | 🚧 | Contrast is weird in some places |
| GTK3 | 🚧 | |
| GTK4 | 🚧 | Runtime switching is unreliable |
## NixOS/Home Manager Module
```nix
# Default options
theming.md3-evo = {
enable = false;
flavour = "tonal-spot";
contrast = 0;
transparency = 0.8;
radius = 24;
padding = 12;
blur = 16;
semantic = {
blend = false;
danger = "#ff0000";
warning = "#ffff00";
success = "#00ff00";
info = "#0000ff";
};
syntax = {
blend = true;
keywords = "#ff8000";
functions = "#0000ff";
properties = "#ff00ff";
constants = "#ff00ff";
strings = "#00ff00";
numbers = "#00ffff";
structures = "#ffff00";
types = "#00ffff";
};
ansi = {
blend = true;
red = "#ff0000";
green = "#00ff00";
yellow = "#ffff00";
orange = "#ff8000";
blue = "#0000ff";
magenta = "#ff00ff";
cyan = "#00ffff";
};
};
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -9,7 +9,7 @@
:root {
--transparencycolor: {{colors.surface.default.red}}, {{colors.surface.default.green}}, {{colors.surface.default.blue}};
--transparencyalpha: 0.8;
--transparencyalpha: {{custom.transparency}};
--messagetransparency: 0;
--guildchanneltransparency: 0;
--chatinputtransparency: 0;
@@ -30,7 +30,7 @@
--popoutsize: var(--backgroundsize);
--popoutblur: var(--backgroundblur);
--backdrop: rgba({{colors.surface.default.red}}, {{colors.surface.default.green}}, {{colors.surface.default.blue}}, 0.8);
--backdrop: rgba({{colors.surface.default.red}}, {{colors.surface.default.green}}, {{colors.surface.default.blue}}, {{custom.transparency}});
--backdropposition: center;
--backdropsize: cover: --backdropblur: 0;

View File

@@ -2,23 +2,23 @@
@define-color accent_bg_color {{colors.primary_container.default.hex}};
@define-color accent_fg_color {{colors.on_primary.default.hex}};
@define-color destructive_color {{colors.error.default.hex}};
@define-color destructive_bg_color {{colors.error_container.default.hex}};
@define-color destructive_fg_color {{colors.on_error.default.hex}};
@define-color destructive_color {{colors.danger.default.hex}};
@define-color destructive_bg_color {{colors.danger_container.default.hex}};
@define-color destructive_fg_color {{colors.on_danger.default.hex}};
@define-color success_color {{colors.ok.default.hex}};
@define-color success_bg_color {{colors.ok_container.default.hex}};
@define-color success_fg_color {{colors.on_ok.default.hex}};
@define-color success_color {{colors.success.default.hex}};
@define-color success_bg_color {{colors.success_container.default.hex}};
@define-color success_fg_color {{colors.on_success.default.hex}};
@define-color warning_color {{colors.warn.default.hex}};
@define-color warning_bg_color {{colors.warn_container.default.hex}};
@define-color warning_fg_color {{colors.on_warn.default.hex}};
@define-color warning_color {{colors.warning.default.hex}};
@define-color warning_bg_color {{colors.warning_container.default.hex}};
@define-color warning_fg_color {{colors.on_warning.default.hex}};
@define-color error_color {{colors.error.default.hex}};
@define-color error_bg_color {{colors.error_container.default.hex}};
@define-color error_fg_color {{colors.on_error.default.hex}};
@define-color window_bg_color alpha({{colors.surface.default.hex}}, 0.8);
@define-color window_bg_color alpha({{colors.surface.default.hex}}, {{custom.transparency}});
@define-color window_fg_color {{colors.on_surface.default.hex}};
@define-color view_bg_color @window_bg_color;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

View File

@@ -0,0 +1,374 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.theme.md3-evo;
in
{
options.theme.md3-evo = {
enable = lib.mkEnableOption "the MD3-EVO theme";
flavour = lib.mkOption {
type = lib.types.enum [
"content"
"expressive"
"fidelity"
"fruit-salad"
"monochrome"
"neutral"
"rainbow"
"tonal-spot"
];
default = "tonal-spot";
description = "The flavour of the theme";
};
contrast = lib.mkOption {
type = lib.types.numbers.between (-1) 1;
default = 0;
description = "Use a modified contrast";
};
transparency = lib.mkOption {
type = lib.types.numbers.between 0 1;
default = 0.8;
description = "The transparency of apps";
};
radius = lib.mkOption {
type = lib.types.ints.positive;
default = 24;
description = "The radius of the corners";
};
padding = lib.mkOption {
type = lib.types.ints.positive;
default = 12;
description = "The padding of the windows";
};
blur = lib.mkOption {
type = lib.types.ints.positive;
default = 16;
description = "The blur amount of windows";
};
semantic = {
blend = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Blend the colors";
};
danger = lib.mkOption {
type = lib.types.str;
default = "#ff0000";
description = "The color of danger";
};
warning = lib.mkOption {
type = lib.types.str;
default = "#ffff00";
description = "The color of warning";
};
success = lib.mkOption {
type = lib.types.str;
default = "#00ff00";
description = "The color of success";
};
info = lib.mkOption {
type = lib.types.str;
default = "#0000ff";
description = "The color of info";
};
};
syntax = {
blend = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Blend the colors";
};
keywords = lib.mkOption {
type = lib.types.str;
default = "#ff8000";
description = "The color of keywords";
};
functions = lib.mkOption {
type = lib.types.str;
default = "#0000ff";
description = "The color of functions";
};
properties = lib.mkOption {
type = lib.types.str;
default = "#ff00ff";
description = "The color of properties";
};
constants = lib.mkOption {
type = lib.types.str;
default = "#ff00ff";
description = "The color of constants";
};
strings = lib.mkOption {
type = lib.types.str;
default = "#00ff00";
description = "The color of variables";
};
numbers = lib.mkOption {
type = lib.types.str;
default = "#00ffff";
description = "The color of numbers";
};
structures = lib.mkOption {
type = lib.types.str;
default = "#ffff00";
description = "The color of structures";
};
types = lib.mkOption {
type = lib.types.str;
default = "#00ffff";
description = "The color of types";
};
};
ansi = {
blend = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Blend the colors";
};
red = lib.mkOption {
type = lib.types.str;
default = "#ff0000";
description = "The color of red";
};
green = lib.mkOption {
type = lib.types.str;
default = "#00ff00";
description = "The color of green";
};
yellow = lib.mkOption {
type = lib.types.str;
default = "#ffff00";
description = "The color of yellow";
};
orange = lib.mkOption {
type = lib.types.str;
default = "#ff8000";
description = "The color of orange";
};
blue = lib.mkOption {
type = lib.types.str;
default = "#0000ff";
description = "The color of blue";
};
magenta = lib.mkOption {
type = lib.types.str;
default = "#ff00ff";
description = "The color of magenta";
};
cyan = lib.mkOption {
type = lib.types.str;
default = "#00ffff";
description = "The color of cyan";
};
};
};
config = lib.mkIf cfg.enable {
home.packages = [
pkgs.adw-gtk3
(pkgs.writeShellApplication {
name = "theme";
runtimeInputs = [
pkgs.matugen
pkgs.swww
pkgs.gnome.zenity
];
text = ''
WALLPAPER=${config.xdg.configHome}/matugen/wallpaper
SCHEME=$(dconf read /org/gnome/desktop/interface/color-scheme)
if [ "$SCHEME" = "'prefer-light'" ]; then
MODE="light"
else
MODE="dark"
fi
if [ $# -eq 0 ]; then
echo -e "\033[1mUsage:\033[0m mode|light|dark|toggle|wallpaper"
exit 1
elif [ "$1" = "mode" ]; then
echo -e "$MODE"
exit 0
elif [ "$1" = "wallpaper" ]; then
if [ $# -eq 1 ]; then
PICKED=$(zenity --file-selection --file-filter='Images | *.png *.jpg *.jpeg *.svg *.bmp *.gif')
cp "$PICKED" "$WALLPAPER"
else
cp "$2" "$WALLPAPER"
fi
elif [ "$1" = "toggle" ]; then
if [ "$MODE" = "light" ]; then
MODE="dark"
else
MODE="light"
fi
elif [ "$1" = "light" ] || [ "$1" = "dark" ]; then
MODE="$1"
elif [ "$1" = "init" ]; then
echo -e "\033[1mSetting up matugen\033[0m"
else
echo -e "\033[31mInvalid argument\033[0m"
exit 1
fi
if [ ! -f $WALLPAPER ]; then
echo -e "\033[31,1mNo wallpaper set\033[0m"
exit 1
fi
if [ "$MODE" = "light" ]; then
GTK_THEME="adw-gtk3"
else
GTK_THEME="adw-gtk3-dark"
fi
matugen image "$WALLPAPER" --type scheme-${cfg.flavour} --contrast ${builtins.toString cfg.contrast} --mode "$MODE"
sed -i "s/set background=dark/set background=$MODE/g" ${config.xdg.configHome}/nvim/colors/md3-evo.vim
dconf write /org/gnome/desktop/interface/gtk-theme "'$GTK_THEME'"
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$MODE'"
if command -v hyprctl &> /dev/null; then
hyprctl reload
fi
for i in $(pgrep -u "$USER" -x nvim); do
kill -USR1 "$i"
done
'';
})
];
programs.kitty = {
extraConfig = ''
include ${config.xdg.configHome}/kitty/theme.conf
'';
};
programs.nixvim = {
opts.termguicolors = true;
colorscheme = "md3-evo";
autoCmd = [
{
event = [ "Signal" ];
pattern = [ "SIGUSR1" ];
command = "colorscheme md3-evo";
}
];
};
gtk = {
gtk3.extraCss = "@import './theme.css';";
gtk4.extraCss = "@import './theme.css';";
};
wayland.windowManager.hyprland = {
settings.exec-once = [
"${pkgs.swww}/bin/swww-daemon"
"theme init"
];
extraConfig = ''
source=./theme.conf
'';
};
programs.matugen = {
enable = true;
settings = {
config = {
reload_apps = true;
reload_apps_list = {
kitty = config.programs.kitty.enable;
waybar = false;
dunst = config.services.dunst.enable;
};
set_wallpaper = true;
wallpaper_tool = "Swww";
custom_colors =
let
mkColor = category: color: {
color = cfg.${category}.${color};
blend = cfg.${category}.blend;
};
in
{
red = mkColor "ansi" "red";
green = mkColor "ansi" "green";
yellow = mkColor "ansi" "yellow";
orange = mkColor "ansi" "orange";
blue = mkColor "ansi" "blue";
magenta = mkColor "ansi" "magenta";
cyan = mkColor "ansi" "cyan";
keywords = mkColor "syntax" "keywords";
functions = mkColor "syntax" "functions";
constants = mkColor "syntax" "constants";
properties = mkColor "syntax" "properties";
strings = mkColor "syntax" "strings";
numbers = mkColor "syntax" "numbers";
structures = mkColor "syntax" "structures";
types = mkColor "syntax" "types";
danger = mkColor "semantic" "danger";
warning = mkColor "semantic" "warning";
success = mkColor "semantic" "success";
info = mkColor "semantic" "info";
};
custom_keywords = {
padding = builtins.toString cfg.padding;
double_padding = builtins.toString (cfg.padding * 2);
radius = builtins.toString cfg.radius;
transparency = builtins.toString cfg.transparency;
blur = builtins.toString cfg.blur;
flavour = cfg.flavour;
contrast = builtins.toString cfg.contrast;
transparency_hex =
let
zeroPad = hex: if builtins.stringLength hex == 1 then "0${hex}" else hex;
in
zeroPad (lib.trivial.toHexString (builtins.floor (cfg.transparency * 255)));
};
};
templates = {
kitty = {
input_path = ./kitty.conf;
output_path = "${config.xdg.configHome}/kitty/theme.conf";
};
nvim = {
input_path = ./nvim.vim;
output_path = "${config.xdg.configHome}/nvim/colors/md3-evo.vim";
};
hyprland = {
input_path = ./hyprland.conf;
output_path = "${config.xdg.configHome}/hypr/theme.conf";
};
anyrun = {
input_path = ./anyrun.css;
output_path = "${config.xdg.configHome}/anyrun/theme.css";
};
gtk3 = {
input_path = ./gtk.css;
output_path = "${config.xdg.configHome}/gtk-3.0/theme.css";
};
gtk4 = {
input_path = ./gtk.css;
output_path = "${config.xdg.configHome}/gtk-4.0/theme.css";
};
vesktop = {
input_path = ./discord.css;
output_path = "${config.xdg.configHome}/vesktop/themes/matugen.theme.css";
};
};
};
};
};
}

View File

@@ -64,33 +64,33 @@ hi Search guifg={{colors.on_tertiary.default.hex}} guibg={{colors.tertiary.defau
hi CmpItemKindCopilot guifg={{colors.cyan.default.hex}}
hi CmpItemKindNpm guifg={{colors.red.default.hex}}
hi Error guibg={{colors.error_container.default.hex}} guifg={{colors.on_error_container.default.hex}}
hi ErrorMsg guibg={{colors.error_container.default.hex}} guifg={{colors.on_error_container.default.hex}}
hi WarningMsg guibg={{colors.warn_container.default.hex}} guifg={{colors.on_warn_container.default.hex}}
hi NvimInternalError guibg={{colors.error.default.hex}} guifg={{colors.on_error.default.hex}}
hi Error guibg={{colors.danger_container.default.hex}} guifg={{colors.on_danger_container.default.hex}}
hi ErrorMsg guibg={{colors.danger_container.default.hex}} guifg={{colors.on_danger_container.default.hex}}
hi WarningMsg guibg={{colors.warning_container.default.hex}} guifg={{colors.on_warning_container.default.hex}}
hi NvimInternalError guibg={{colors.danger.default.hex}} guifg={{colors.on_danger.default.hex}}
hi DiagnosticError guifg={{colors.error.default.hex}}
hi DiagnosticWarn guifg={{colors.warn.default.hex}}
hi DiagnosticInfo guifg={{colors.blue.default.hex}}
hi DiagnosticError guifg={{colors.danger.default.hex}}
hi DiagnosticWarn guifg={{colors.warning.default.hex}}
hi DiagnosticInfo guifg={{colors.info.default.hex}}
hi DiagnosticHint guifg={{colors.outline.default.hex}}
hi DiagnosticOk guifg={{colors.ok.default.hex}}
hi DiagnosticOk guifg={{colors.success.default.hex}}
hi RedrawDebugNormal guibg={{colors.surface_variant.default.hex}} guifg={{colors.on_surface_variant.default.hex}}
hi RedrawDebugClear guibg={{colors.warn.default.hex}} guifg={{colors.on_warn.default.hex}}
hi RedrawDebugComposed guibg={{colors.ok.default.hex}} guifg={{colors.on_ok.default.hex}}
hi RedrawDebugRecompose guibg={{colors.error.default.hex}} guifg={{colors.on_error.default.hex}}
hi RedrawDebugClear guibg={{colors.warning.default.hex}} guifg={{colors.on_warning.default.hex}}
hi RedrawDebugComposed guibg={{colors.success.default.hex}} guifg={{colors.on_success.default.hex}}
hi RedrawDebugRecompose guibg={{colors.danger.default.hex}} guifg={{colors.on_danger.default.hex}}
hi DiagnosticUnderlineError gui=undercurl guisp={{colors.error.default.hex}}
hi DiagnosticUnderlineWarn gui=undercurl guisp={{colors.warn.default.hex}}
hi DiagnosticUnderlineInfo gui=undercurl guisp={{colors.blue.default.hex}}
hi DiagnosticUnderlineError gui=undercurl guisp={{colors.danger.default.hex}}
hi DiagnosticUnderlineWarn gui=undercurl guisp={{colors.warning.default.hex}}
hi DiagnosticUnderlineInfo gui=undercurl guisp={{colors.info.default.hex}}
hi DiagnosticUnderlineHint gui=undercurl guisp={{colors.outline.default.hex}}
hi DiagnosticUnderlineOk gui=undercurl guisp={{colors.ok.default.hex}}
hi DiagnosticDeprecated gui=strikethrough guisp={{colors.error.default.hex}}
hi DiagnosticUnderlineOk gui=undercurl guisp={{colors.success.default.hex}}
hi DiagnosticDeprecated gui=strikethrough guisp={{colors.danger.default.hex}}
hi SpellBad gui=undercurl guisp={{colors.green.default.hex}}
hi SpellCap gui=undercurl guisp={{colors.green.default.hex}}
hi SpellRare gui=undercurl guisp={{colors.green.default.hex}}
hi SpellLocal gui=undercurl guisp={{colors.green.default.hex}}
hi SpellBad gui=undercurl guisp={{colors.success.default.hex}}
hi SpellCap gui=undercurl guisp={{colors.success.default.hex}}
hi SpellRare gui=undercurl guisp={{colors.success.default.hex}}
hi SpellLocal gui=undercurl guisp={{colors.success.default.hex}}
hi DiffAdd guibg={{colors.green_container.default.hex}} guifg={{colors.on_green_container.default.hex}}
hi DiffChange guibg={{colors.yellow_container.default.hex}} guifg={{colors.on_yellow_container.default.hex}}
@@ -100,7 +100,7 @@ hi DiffText guibg={{colors.blue_container.default.hex}} guifg={{colors.on_blue_c
hi NeoTreeGitAdded guifg={{colors.green.default.hex}}
hi NeoTreeGitDeleted guifg={{colors.red.default.hex}}
hi NeoTreeGitModified guifg={{colors.yellow.default.hex}}
hi NeoTreeGitConflict guifg={{colors.error.default.hex}}
hi NeoTreeGitConflict guifg={{colors.danger.default.hex}}
hi NeoTreeGitUntracked guifg={{colors.blue.default.hex}}
hi NonText guifg={{colors.outline_variant.default.hex}}
@@ -117,7 +117,7 @@ hi Todo guibg={{colors.yellow_container.default.hex}} guifg={{colors.on_yellow_c
hi def link @comment.todo Todo
hi def link @comment.error Error
hi String guifg={{colors.green.default.hex}}
hi String guifg={{colors.strings.default.hex}}
hi Identifier guifg={{colors.on_surface.default.hex}}
hi Statement gui=bold guifg={{colors.on_surface.default.hex}}
@@ -131,22 +131,23 @@ hi def link @parameter Identifier
hi @lsp.mod.defaultLibrary gui=bold
hi @lsp.mod.readonly gui=italic
hi Constant guifg={{colors.magenta.default.hex}}
hi Constant guifg={{colors.constants.default.hex}}
hi def link @variable Constant
hi def link @field Constant
hi def link @property @field
hi @property guifg={{colors.properties.default.hex}}
hi def link @field @property
hi def link @label.json @property
hi def link @label.jsonc @label.json
hi def link @property.typescript @property
hi def link @lsp.type.property @property
hi def link @attribute Constant
hi def link @tag.attribute Constant
hi def link @attribute @property
hi def link @tag.attribute @property
hi def link @lsp.type.variable Constant
hi def link @lsp.typemod.variable.local Identifier
hi Keyword guifg={{colors.orange.default.hex}}
hi Special guifg={{colors.orange.default.hex}}
hi Keyword guifg={{colors.keywords.default.hex}}
hi Special guifg={{colors.keywords.default.hex}}
hi def link Character Keyword
hi def link Boolean Keyword
hi def link Repeat Keyword
@@ -156,13 +157,13 @@ hi def link Include Keyword
hi def link Conditional Keyword
hi def link @type.builtin Keyword
hi Number guifg={{colors.cyan.default.hex}}
hi Function guifg={{colors.cyan.default.hex}}
hi Number guifg={{colors.numbers.default.hex}}
hi Function guifg={{colors.functions.default.hex}}
hi Structure guifg={{colors.yellow.default.hex}}
hi Structure guifg={{colors.structures.default.hex}}
hi def link PreProc Structure
hi def link Tag Structure
hi Type gui=none guifg={{colors.blue.default.hex}}
hi Type gui=none guifg={{colors.types.default.hex}}
hi def link @lsp.type.interface Type
hi IlluminatedWordText gui=none guibg={{colors.surface_container_highest.default.hex}}

View File

@@ -22,8 +22,6 @@
./locales/theaninova.nix
./theming/matugen.nix
./usecases/gaming.nix
./usecases/3d-printing.nix
./usecases/development.nix

View File

@@ -1,257 +0,0 @@
{
pkgs,
lib,
config,
username,
...
}:
let
cfg = config.theming.md3-evo;
homeCfg = config.home-manager.users.${username};
in
{
options.theming.md3-evo = {
enable = lib.mkEnableOption "the MD3-EVO theme";
flavour = lib.mkOption {
type = lib.types.enum [
"content"
"expressive"
"fidelity"
"fruit-salad"
"monochrome"
"neutral"
"rainbow"
"tonal-spot"
];
default = "tonal-spot";
description = "The flavour of the theme";
};
contrast = lib.mkOption {
type = lib.types.numbers.between (-1) 1;
default = 0;
description = "Use a modified contrast";
};
transparency = lib.mkOption {
type = lib.types.numbers.between 0 1;
default = 0.8;
description = "The transparency of apps";
};
radius = lib.mkOption {
type = lib.types.ints.positive;
default = 24;
description = "The radius of the corners";
};
padding = lib.mkOption {
type = lib.types.ints.positive;
default = 12;
description = "The padding of the windows";
};
blur = lib.mkOption {
type = lib.types.ints.positive;
default = 16;
description = "The blur amount of windows";
};
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [
pkgs.adw-gtk3
pkgs.matugen
(pkgs.writeShellApplication {
name = "theme";
runtimeInputs = [
pkgs.matugen
pkgs.swww
pkgs.gnome.zenity
];
text = ''
WALLPAPER=${homeCfg.xdg.configHome}/matugen/wallpaper
SCHEME=$(dconf read /org/gnome/desktop/interface/color-scheme)
if [ "$SCHEME" = "'prefer-light'" ]; then
MODE="light"
else
MODE="dark"
fi
if [ $# -eq 0 ]; then
echo -e "\033[1mUsage:\033[0m mode|light|dark|toggle|wallpaper"
exit 1
elif [ "$1" = "mode" ]; then
echo -e "$MODE"
exit 0
elif [ "$1" = "wallpaper" ]; then
if [ $# -eq 1 ]; then
PICKED=$(zenity --file-selection --file-filter='Images | *.png *.jpg *.jpeg *.svg *.bmp *.gif')
cp "$PICKED" "$WALLPAPER"
else
cp "$2" "$WALLPAPER"
fi
elif [ "$1" = "toggle" ]; then
if [ "$MODE" = "light" ]; then
MODE="dark"
else
MODE="light"
fi
elif [ "$1" = "light" ] || [ "$1" = "dark" ]; then
MODE="$1"
elif [ "$1" = "init" ]; then
echo -e "\033[1mSetting up matugen\033[0m"
else
echo -e "\033[31mInvalid argument\033[0m"
exit 1
fi
if [ ! -f $WALLPAPER ]; then
echo -e "\033[31,1mNo wallpaper set\033[0m"
exit 1
fi
if [ "$MODE" = "light" ]; then
GTK_THEME="adw-gtk3"
else
GTK_THEME="adw-gtk3-dark"
fi
matugen image "$WALLPAPER" --type scheme-${cfg.flavour} --contrast ${builtins.toString cfg.contrast} --mode "$MODE"
sed -i "s/set background=dark/set background=$MODE/g" ${homeCfg.xdg.configHome}/nvim/colors/md3-evo.vim
dconf write /org/gnome/desktop/interface/gtk-theme "'$GTK_THEME'"
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$MODE'"
if command -v hyprctl &> /dev/null; then
hyprctl reload
fi
for i in $(pgrep -u "$USER" -x nvim); do
kill -USR1 "$i"
done
'';
})
];
};
home-manager.users.${username} = {
programs.kitty = {
extraConfig = ''
include ${homeCfg.xdg.configHome}/kitty/theme.conf
'';
};
programs.nixvim = {
opts.termguicolors = true;
colorscheme = "md3-evo";
autoCmd = [
{
event = [ "Signal" ];
pattern = [ "SIGUSR1" ];
command = "colorscheme md3-evo";
}
];
};
gtk = {
gtk3.extraCss = "@import './theme.css';";
gtk4.extraCss = "@import './theme.css';";
};
wayland.windowManager.hyprland = {
settings.exec-once = [
"${pkgs.swww}/bin/swww-daemon"
"theme init"
];
extraConfig = ''
source=./theme.conf
'';
};
xdg.configFile."matugen/config.toml" = {
/*
onChange = ''
theme init
'';
*/
source = (pkgs.formats.toml { }).generate "matugen" {
config = {
reload_apps = true;
reload_apps_list = {
kitty = homeCfg.programs.kitty.enable;
waybar = false;
dunst = homeCfg.services.dunst.enable;
};
set_wallpaper = true;
wallpaper_tool = "Swww";
custom_colors = {
red = "#ff0000";
green = "#00ff00";
yellow = "#ffff00";
orange = "#ff8000";
blue = "#0000ff";
magenta = "#ff00ff";
cyan = "#00ffff";
warn = {
color = "#ffff00";
blend = false;
};
ok = {
color = "#00ff00";
blend = false;
};
};
custom_keywords = {
padding = builtins.toString cfg.padding;
double_padding = builtins.toString (cfg.padding * 2);
radius = builtins.toString cfg.radius;
transparency = builtins.toString cfg.transparency;
blur = builtins.toString cfg.blur;
flavour = cfg.flavour;
contrast = builtins.toString cfg.contrast;
transparency_hex =
let
zeroPad = hex: if builtins.stringLength hex == 1 then "0${hex}" else hex;
in
zeroPad (lib.trivial.toHexString (builtins.floor (cfg.transparency * 255)));
};
};
templates = {
kitty = {
input_path = ./kitty.conf;
output_path = "${homeCfg.xdg.configHome}/kitty/theme.conf";
};
nvim = {
input_path = ./nvim.vim;
output_path = "${homeCfg.xdg.configHome}/nvim/colors/md3-evo.vim";
};
hyprland = {
input_path = ./hyprland.conf;
output_path = "${homeCfg.xdg.configHome}/hypr/theme.conf";
};
anyrun = {
input_path = ./anyrun.css;
output_path = "${homeCfg.xdg.configHome}/anyrun/theme.css";
};
gtk3 = {
input_path = ./gtk.css;
output_path = "${homeCfg.xdg.configHome}/gtk-3.0/theme.css";
};
gtk4 = {
input_path = ./gtk.css;
output_path = "${homeCfg.xdg.configHome}/gtk-4.0/theme.css";
};
vesktop = {
input_path = ./discord.css;
output_path = "${homeCfg.xdg.configHome}/vesktop/themes/matugen.theme.css";
};
};
};
};
};
};
}

View File

@@ -1,53 +0,0 @@
{
lib,
scdoc,
buildGoModule,
fetchFromGitLab,
hidapi,
udev,
}:
buildGoModule rec {
pname = "darkman";
version = "1.5.4";
src = fetchFromGitLab {
owner = "WhyNotHugo";
repo = "darkman";
rev = "5332193777fb0c5dbde6cbfd015a16697d6a0c8e";
hash = "sha256-3TGDy7hiI+z0IrA+d/Q+rMFlew6gipdpXyJ5eVLCmds=";
};
vendorHash = "sha256-xEPmNnaDwFU4l2G4cMvtNeQ9KneF5g9ViQSFrDkrafY=";
nativeBuildInputs = [ scdoc ];
postPatch = ''
substituteInPlace darkman.service \
--replace "/usr/bin/darkman" "$out/bin/darkman"
substituteInPlace contrib/dbus/nl.whynothugo.darkman.service \
--replace "/usr/bin/darkman" "$out/bin/darkman"
substituteInPlace contrib/dbus/org.freedesktop.impl.portal.desktop.darkman.service \
--replace "/usr/bin/darkman" "$out/bin/darkman"
'';
buildPhase = ''
runHook preBuild
make build
runHook postBuild
'';
installPhase = ''
runHook preInstall
make PREFIX=$out install
runHook postInstall
'';
meta = with lib; {
description = "Framework for dark-mode and light-mode transitions on Linux desktop";
homepage = "https://gitlab.com/WhyNotHugo/darkman";
license = licenses.isc;
maintainers = [ maintainers.ajgrf ];
platforms = platforms.linux;
mainProgram = "darkman";
};
}