Skip to content

Commit

Permalink
treewide: use matugen for theme generation
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Sep 16, 2023
1 parent 86b3775 commit 3b40452
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 130 deletions.
24 changes: 13 additions & 11 deletions home/programs/dunst.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
pkgs,
default,
theme,
...
}: {
# notification daemon
services.dunst = {
services.dunst = let
c = theme.xcolors.colors.${theme.variant};
in {
enable = true;
iconTheme = {
name = "Papirus-Dark";
Expand Down Expand Up @@ -39,19 +41,19 @@
fullscreen_delay_everything = {fullscreen = "delay";};

urgency_critical = {
background = default.xcolors.bg;
foreground = default.xcolors.fg;
frame_color = default.xcolors.red;
background = c.error_container;
foreground = c.on_error_container;
frame_color = c.error;
};
urgency_low = {
background = default.xcolors.bg;
foreground = default.xcolors.fg;
frame_color = default.xcolors.blue;
background = c.secondary_container;
foreground = c.on_secondary_container;
frame_color = c.secondary;
};
urgency_normal = {
background = default.xcolors.bg;
foreground = default.xcolors.fg;
frame_color = default.xcolors.green;
background = c.primary_container;
foreground = c.on_primary_container;
frame_color = c.primary;
};
};
};
Expand Down
6 changes: 1 addition & 5 deletions home/programs/git.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{
config,
pkgs,
default,
...
}: {
home.packages = [pkgs.gh];

programs.git = {
enable = true;

delta = {
enable = true;
options.map-styles = "bold purple => syntax ${default.xcolors.mauve}, bold cyan => syntax ${default.xcolors.blue}";
};
delta.enable = true;

extraConfig = {
diff.colorMoved = "default";
Expand Down
33 changes: 12 additions & 21 deletions home/terminals/alacritty.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{default, ...}:
{
pkgs,
default,
...
}:
# terminals
let
inherit (default.terminal) font size opacity;
inherit (default) xcolors;
in {
programs.alacritty = {
enable = true;
Expand All @@ -27,26 +30,14 @@ in {
};

draw_bold_text_with_bright_colors = true;
colors = rec {
primary = {
background = xcolors.crust;
foreground = xcolors.fg;
};
normal = {
inherit (xcolors) red green yellow blue;
black = xcolors.mantle;
magenta = xcolors.mauve;
cyan = xcolors.sky;
white = xcolors.text;
};
bright =
normal
// {
black = xcolors.base;
white = xcolors.rosewater;
};
};
window.opacity = opacity;

imports = [
(pkgs.fetchurl {
url = "https://raw.githubusercontent.com/catppuccin/alacritty/3c808cbb4f9c87be43ba5241bc57373c793d2f17/catppuccin-mocha.yml";
hash = "sha256-28Tvtf8A/rx40J9PKXH6NL3h/OKfn3TQT1K9G8iWCkM=";
})
];
};
};
}
34 changes: 4 additions & 30 deletions home/terminals/kitty.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
{default, ...}: let
inherit (default) xcolors;
in {
{default, ...}: {
programs.kitty = {
enable = true;
font = {
inherit (default.terminal) size;
name = default.terminal.font;
};

settings = {
scrollback_lines = 10000;
placement_strategy = "center";

allow_remote_control = "yes";
enable_audio_bell = "no";
visual_bell_duration = "0.1";
visual_bell_color = xcolors.rosewater;

copy_on_select = "clipboard";

Expand All @@ -23,32 +21,8 @@ in {

# colors
background_opacity = toString default.terminal.opacity;
foreground = xcolors.fg;
background = xcolors.crust;
# black
color0 = xcolors.mantle;
color8 = xcolors.base;
# red
color1 = xcolors.red;
color9 = xcolors.red;
# green
color2 = xcolors.green;
color10 = xcolors.green;
# yellow
color3 = xcolors.yellow;
color11 = xcolors.yellow;
# blue
color4 = xcolors.blue;
color12 = xcolors.blue;
# magenta
color5 = xcolors.pink;
color13 = xcolors.pink;
# cyan
color6 = xcolors.sky;
color14 = xcolors.sky;
# white
color7 = xcolors.text;
color15 = xcolors.rosewater;
};

theme = "Catppuccin-Mocha";
};
}
7 changes: 4 additions & 3 deletions home/wayland/hyprland/config.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
config,
default,
theme,
...
}: let
inherit (default) colors;
c = theme.colors.colors_android.${theme.variant};

pointer = config.home.pointerCursor;
scriptDir = "${config.home.homeDirectory}/.config/eww/scripts";
Expand Down Expand Up @@ -80,8 +81,8 @@ in {
col.inactive_border = rgba(00000088)
# group borders
col.group_border_active = rgba(${colors.pink}88)
col.group_border = rgba(${colors.surface0}88)
col.group_border_active = rgba(${c.color_accent_primary}88)
col.group_border = rgba(${c.color_accent_primary_variant}88)
}
decoration {
Expand Down
16 changes: 5 additions & 11 deletions lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{lib, ...}:
# personal lib
let
colorlib = import ./colors.nix lib;
in {
imports = [
{
# get default across the module system
_module.args = {
default = import ./theme {inherit colorlib lib;};
};
}
];
{
# get default across the module system
_module.args = {
default = import ./theme lib;
};
}
File renamed without changes.
37 changes: 0 additions & 37 deletions lib/theme/colors.nix

This file was deleted.

12 changes: 1 addition & 11 deletions lib/theme/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
{
colorlib,
lib,
}: rec {
colors = import ./colors.nix;
# #RRGGBB
xcolors = lib.mapAttrs (_: colorlib.x) colors;
# rgba(,,,) colors (css)
rgbaColors = lib.mapAttrs (_: colorlib.rgba) colors;

lib: {
browser = "firefox";

launcher = "anyrun";

terminal = {
Expand Down
13 changes: 13 additions & 0 deletions lib/theme/theme.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
self: pkgs: let
inherit (pkgs) lib;
colors = builtins.fromJSON (builtins.readFile self.packages.${pkgs.system}.theme.outPath);
colorlib = import "${self}/lib/theme/colorlib.nix" lib;
in {
inherit colors;
# #RRGGBB
xcolors = lib.mapAttrsRecursive (_: colorlib.x) colors;
# rgba(,,,) colors (css)
rgbaColors = lib.mapAttrsRecursive (_: colorlib.rgba) colors;

variant = "dark";
}
16 changes: 15 additions & 1 deletion modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,21 @@ in {

# NixOS modules
sharedModules = [
{home-manager.useGlobalPkgs = true;}
({
pkgs,
self,
...
}: let
theme = import "${self}/lib/theme/theme.nix" self pkgs;
in {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.mihai._module.args = {inherit theme;};
};
_module.args = {inherit theme;};
})

{disabledModules = ["security/pam.nix"];}
inputs.agenix.nixosModules.default
inputs.hm.nixosModule
Expand Down

0 comments on commit 3b40452

Please sign in to comment.