diff --git a/flake.lock b/flake.lock index d08ba0fc..406149c4 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,118 @@ "type": "github" } }, + "base16-alacritty": { + "flake": false, + "locked": { + "lastModified": 1674275109, + "narHash": "sha256-Adwx9yP70I6mJrjjODOgZJjt4OPPe8gJu7UuBboXO4M=", + "owner": "aarowill", + "repo": "base16-alacritty", + "rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7", + "type": "github" + }, + "original": { + "owner": "aarowill", + "repo": "base16-alacritty", + "type": "github" + } + }, + "base16-fish": { + "flake": false, + "locked": { + "lastModified": 1622559957, + "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", + "owner": "tomyun", + "repo": "base16-fish", + "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", + "type": "github" + }, + "original": { + "owner": "tomyun", + "repo": "base16-fish", + "type": "github" + } + }, + "base16-foot": { + "flake": false, + "locked": { + "lastModified": 1696725948, + "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "owner": "tinted-theming", + "repo": "base16-foot", + "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-foot", + "type": "github" + } + }, + "base16-helix": { + "flake": false, + "locked": { + "lastModified": 1696727917, + "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", + "owner": "tinted-theming", + "repo": "base16-helix", + "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-helix", + "type": "github" + } + }, + "base16-kitty": { + "flake": false, + "locked": { + "lastModified": 1665001328, + "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", + "owner": "kdrag0n", + "repo": "base16-kitty", + "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", + "type": "github" + }, + "original": { + "owner": "kdrag0n", + "repo": "base16-kitty", + "type": "github" + } + }, + "base16-tmux": { + "flake": false, + "locked": { + "lastModified": 1696725902, + "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", + "owner": "tinted-theming", + "repo": "base16-tmux", + "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-tmux", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1663659192, + "narHash": "sha256-uJvaYYDMXvoo0fhBZUhN8WBXeJ87SRgof6GEK2efFT0=", + "owner": "chriskempson", + "repo": "base16-vim", + "rev": "3be3cd82cd31acfcab9a41bad853d9c68d30478d", + "type": "github" + }, + "original": { + "owner": "chriskempson", + "repo": "base16-vim", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -57,11 +169,11 @@ ] }, "locked": { - "lastModified": 1689134369, - "narHash": "sha256-0G9dutIvhS/WUr3Awcnqw71g8EVVvvkOhVDnDDbY4Fw=", + "lastModified": 1691882297, + "narHash": "sha256-e1/LAQSGLnBywfA1TfMl0Vj3tvYka73XOZ/D2/CJowE=", "owner": "nix-community", "repo": "home-manager", - "rev": "e42fb59768f0305085abde0dd27ab5e0cc15420c", + "rev": "c3ab5ea047e6dc73df530948f7367455749d8906", "type": "github" }, "original": { @@ -72,11 +184,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1690441914, - "narHash": "sha256-Ac+kJQ5z9MDAMyzSc0i0zJDx2i3qi9NjlW5Lz285G/I=", + "lastModified": 1691853136, + "narHash": "sha256-wTzDsRV4HN8A2Sl0SVQY0q8ILs90CD43Ha//7gNZE+E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "db8672b8d0a2593c2405aed0c1dfa64b2a2f428f", + "rev": "f0451844bbdf545f696f029d1448de4906c7f753", "type": "github" }, "original": { @@ -89,6 +201,13 @@ "root": { "inputs": { "base16": "base16", + "base16-alacritty": "base16-alacritty", + "base16-fish": "base16-fish", + "base16-foot": "base16-foot", + "base16-helix": "base16-helix", + "base16-kitty": "base16-kitty", + "base16-tmux": "base16-tmux", + "base16-vim": "base16-vim", "flake-compat": "flake-compat", "home-manager": "home-manager", "nixpkgs": "nixpkgs" diff --git a/flake.nix b/flake.nix index 96586693..e1247886 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,36 @@ url = "github:edolstra/flake-compat"; flake = false; }; + + # Templates + base16-alacritty = { + url = "github:aarowill/base16-alacritty"; + flake = false; + }; + base16-fish = { + url = "github:tomyun/base16-fish"; + flake = false; + }; + base16-foot = { + url = "github:tinted-theming/base16-foot"; + flake = false; + }; + base16-helix = { + url = "github:tinted-theming/base16-helix"; + flake = false; + }; + base16-kitty = { + url = "github:kdrag0n/base16-kitty"; + flake = false; + }; + base16-tmux = { + url = "github:tinted-theming/base16-tmux"; + flake = false; + }; + base16-vim = { + url = "github:chriskempson/base16-vim"; + flake = false; + }; }; outputs = @@ -39,7 +69,7 @@ nixosModules.stylix = { pkgs, ... }@args: { imports = [ - (import ./stylix/nixos { + (import ./stylix/nixos inputs { inherit (self.packages.${pkgs.system}) palette-generator; base16 = base16.lib args; homeManagerModule = self.homeManagerModules.stylix; @@ -49,7 +79,7 @@ homeManagerModules.stylix = { pkgs, ... }@args: { imports = [ - (import ./stylix/hm { + (import ./stylix/hm inputs { inherit (self.packages.${pkgs.system}) palette-generator; base16 = base16.lib args; }) @@ -58,7 +88,7 @@ darwinModules.stylix = { pkgs, ... }@args: { imports = [ - (import ./stylix/darwin { + (import ./stylix/darwin inputs { inherit (self.packages.${pkgs.system}) palette-generator; base16 = base16.lib args; homeManagerModule = self.homeManagerModules.stylix; diff --git a/modules/alacritty/hm.nix b/modules/alacritty/hm.nix index c40023ec..a9cd2780 100644 --- a/modules/alacritty/hm.nix +++ b/modules/alacritty/hm.nix @@ -4,12 +4,7 @@ with config.stylix.fonts; let themeFile = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "aarowill"; - repo = "base16-alacritty"; - rev = "914727e48ebf3eab1574e23ca0db0ecd0e5fe9d0"; - sha256 = "sha256-oDsuiKx8gt+Ov7hZ9PibIQtE81IRSLO+n5N99WeiK34="; - }; + templateRepo = config.lib.stylix.templates.base16-alacritty; }; in { diff --git a/modules/bat/hm.nix b/modules/bat/hm.nix index fd154730..80be228e 100644 --- a/modules/bat/hm.nix +++ b/modules/bat/hm.nix @@ -1,17 +1,14 @@ { pkgs, config, lib, ... }: -let - themeFile = config.lib.stylix.colors { - template = ./base16-stylix.mustache; - extension = ".tmTheme"; - }; -in { options.stylix.targets.bat.enable = config.lib.stylix.mkEnableTarget "Bat" config.programs.bat.enable; config = lib.mkIf config.stylix.targets.bat.enable { - programs.bat.themes."base16-stylix" = builtins.readFile themeFile; + programs.bat.themes."base16-stylix".src = config.lib.stylix.colors { + template = ./base16-stylix.mustache; + extension = ".tmTheme"; + }; home.sessionVariables.BAT_THEME = "base16-stylix"; }; } diff --git a/modules/emacs/hm.nix b/modules/emacs/hm.nix index 79d2d1f3..f97f18fc 100644 --- a/modules/emacs/hm.nix +++ b/modules/emacs/hm.nix @@ -16,6 +16,7 @@ in [ (epkgs.trivialBuild { pname = "base16-stylix-theme"; + version = "0.1.0"; src = pkgs.writeText "base16-stylix-theme.el" '' (require 'base16-theme) diff --git a/modules/fish/prompt.nix b/modules/fish/prompt.nix index 6198a49b..f6b4e2e0 100644 --- a/modules/fish/prompt.nix +++ b/modules/fish/prompt.nix @@ -2,12 +2,7 @@ let theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tomyun"; - repo = "base16-fish"; - rev = "7f647967fddedaf803191bc9113b13d2071dc3cf"; - sha256 = "IGUbLjsmmAvB9UKGkR7oqdpjeVEfzt83GpyBkrZf2O4="; - }; + templateRepo = config.lib.stylix.templates.base16-fish; }; in '' source ${theme} diff --git a/modules/foot/hm.nix b/modules/foot/hm.nix index 2aef65ca..8a4865f4 100644 --- a/modules/foot/hm.nix +++ b/modules/foot/hm.nix @@ -4,12 +4,7 @@ let cfg = config.stylix.targets.foot; theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-foot"; - rev = "22579065fbe21361b64d80bae798666efaa85ce0"; - sha256 = "gb43UufuN6iRu6MfTZP+a3GUUQ+hKa5e6G4IiWEc68A="; - }; + templateRepo = config.lib.stylix.templates.base16-foot; }; in { diff --git a/modules/gtk/hm.nix b/modules/gtk/hm.nix index 5b7d808b..9657dbd2 100644 --- a/modules/gtk/hm.nix +++ b/modules/gtk/hm.nix @@ -11,8 +11,8 @@ let }; finalCss = pkgs.runCommandLocal "gtk.css" {} '' - echo ${escapeShellArg cfg.extraCss} >>$out cat ${baseCss} >>$out + echo ${escapeShellArg cfg.extraCss} >>$out ''; in { diff --git a/modules/helix/hm.nix b/modules/helix/hm.nix index bb583a0f..5af016c1 100644 --- a/modules/helix/hm.nix +++ b/modules/helix/hm.nix @@ -2,12 +2,7 @@ let theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-helix"; - rev = "3e391da3aaf2fa43dc9cfb67e4e6216c7ce163dc"; - sha256 = "elhPirlFx9UaZGTht9jFl8lLfT4Af38ITTPJT90yrHs="; - }; + templateRepo = config.lib.stylix.templates.base16-helix; }; # Removing the background exposes transparency from the terminal. The diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix new file mode 100644 index 00000000..b8a2084b --- /dev/null +++ b/modules/hyprland/hm.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: + +with config.lib.stylix.colors; + +let + rgb = color: "rgb(${color})"; + rgba = color: alpha: "rgba(${color}${alpha})"; + + settings = { + decoration."col.shadow" = rgba base00 "99"; + general = { + "col.active_border" = rgb base0A; + "col.inactive_border" = rgb base03; + "col.group_border" = rgb base0D; + "col.group_border_active" = rgb base06; + "col.group_border_locked_active" = rgb base06; + }; + misc.background_color = rgb base00; + }; + +in { + options.stylix.targets.hyprland.enable = + config.lib.stylix.mkEnableTarget "Hyprland" true; + + config.wayland.windowManager.hyprland.settings = + lib.mkIf config.stylix.targets.hyprland.enable settings; +} diff --git a/modules/kitty/hm.nix b/modules/kitty/hm.nix index bfe9526f..240caa28 100644 --- a/modules/kitty/hm.nix +++ b/modules/kitty/hm.nix @@ -3,12 +3,7 @@ let cfg = config.stylix.targets.kitty; theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "kdrag0n"; - repo = "base16-kitty"; - rev = "06bb401fa9a0ffb84365905ffbb959ae5bf40805"; - sha256 = "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY="; - }; + templateRepo = config.lib.stylix.templates.base16-kitty; target = if cfg.variant256Colors then "default-256" else "default"; }; in { @@ -32,7 +27,9 @@ in { size = config.stylix.fonts.sizes.terminal; }; settings.background_opacity = with config.stylix.opacity; "${builtins.toString terminal}"; - extraConfig = builtins.readFile theme; + extraConfig = '' + include ${theme} + ''; }; }; } diff --git a/modules/qutebrowser/hm.nix b/modules/qutebrowser/hm.nix index 7420d642..c7eb440e 100644 --- a/modules/qutebrowser/hm.nix +++ b/modules/qutebrowser/hm.nix @@ -195,6 +195,13 @@ in { }; }; }; + webpage = let + isDark = config.stylix.polarity == "dark"; + in { + darkmode.enabled = lib.mkIf isDark (lib.mkDefault true); + preferred_color_scheme = lib.mkIf + isDark (lib.mkDefault config.stylix.polarity); + }; }; fonts = let diff --git a/modules/rofi/template.mustache b/modules/rofi/template.mustache index 72bdd52a..9ddeb2fc 100644 --- a/modules/rofi/template.mustache +++ b/modules/rofi/template.mustache @@ -1,11 +1,3 @@ -/** - * Base16 {{scheme-name}} ROFI Color theme - * - * Authors - * Scheme: {{scheme-author}} - * Template: Tinted Theming (https://github.com/tinted-theming) - */ - * { background-color: rgba ( {{base00-rgb-r}}, {{base00-rgb-g}}, {{base00-rgb-b}}, 0 % ); separatorcolor: @foreground; @@ -40,42 +32,23 @@ alternate-normal-text: rgba ( {{base05-rgb-r}}, {{base05-rgb-g}}, {{base05-rgb-b}}, 100 % ); alternate-active-text: rgba ( {{base0D-rgb-r}}, {{base0D-rgb-g}}, {{base0D-rgb-b}}, 100 % ); alternate-urgent-text: rgba ( {{base08-rgb-r}}, {{base08-rgb-g}}, {{base08-rgb-b}}, 100 % ); - - spacing: 2; } window { background-color: @background; - border: 1; - padding: 5; -} -mainbox { - border: 0; - padding: 0; } message { - border: 1px dash 0px 0px ; border-color: @separatorcolor; - padding: 1px ; } textbox { text-color: @base-text; } listview { - fixed-height: 0; - border: 2px dash 0px 0px ; border-color: @separatorcolor; - spacing: 2px ; - scrollbar: true; - padding: 2px 0px 0px ; } element-text, element-icon { background-color: inherit; text-color: inherit; } -element { - border: 0; - padding: 1px ; -} element normal.normal { background-color: @normal-background; text-color: @normal-text; @@ -113,18 +86,12 @@ element alternate.active { text-color: @alternate-active-text; } scrollbar { - width: 4px ; - border: 0; handle-color: @normal-foreground; - handle-width: 8px ; - padding: 0; } sidebar { - border: 2px dash 0px 0px ; border-color: @separatorcolor; } button { - spacing: 0; text-color: @normal-text; } button selected { @@ -132,26 +99,17 @@ button selected { text-color: @selected-normal-text; } inputbar { - spacing: 0px; text-color: @normal-text; - padding: 1px ; - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; } case-indicator { - spacing: 0; text-color: @normal-text; } entry { - spacing: 0; text-color: @normal-text; } prompt { - spacing: 0; text-color: @normal-text; } textbox-prompt-colon { - expand: false; - str: ":"; - margin: 0px 0.3000em 0.0000em 0.0000em ; text-color: inherit; } diff --git a/modules/tmux/hm.nix b/modules/tmux/hm.nix index 027b11c9..6101dcc8 100644 --- a/modules/tmux/hm.nix +++ b/modules/tmux/hm.nix @@ -2,12 +2,7 @@ let theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-tmux"; - rev = "30fc84afc723e027d4497a284fcae3cb75097441"; - sha256 = "JJ/eRqTayuEKrL9MBe943HpKy7yLyd2Dmes58KN1jdk="; - }; + templateRepo = config.lib.stylix.templates.base16-tmux; }; in { diff --git a/modules/vim/hm.nix b/modules/vim/hm.nix index 50ad62fa..b67211d9 100644 --- a/modules/vim/hm.nix +++ b/modules/vim/hm.nix @@ -4,12 +4,7 @@ with lib; let themeFile = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "chriskempson"; - repo = "base16-vim"; - rev = "6191622d5806d4448fa2285047936bdcee57a098"; - sha256 = "6FsT87qcl9GBxgxrPx2bPULIMA/O8TRxHaN49qMM4uM="; - }; + templateRepo = config.lib.stylix.templates.base16-vim; }; themePlugin = pkgs.vimUtils.buildVimPlugin { diff --git a/modules/wezterm/hm.nix b/modules/wezterm/hm.nix index 9049957d..7410fba6 100644 --- a/modules/wezterm/hm.nix +++ b/modules/wezterm/hm.nix @@ -12,7 +12,7 @@ in { brights = [ base03 base08 base0B base0A base0D base0E base0C base07 ]; background = base00; cursor_bg = base05; - cursor_fg = base05; + cursor_fg = base00; compose_cursor = base06; foreground = base05; scrollbar_thumb = base01; diff --git a/modules/xfce/hm.nix b/modules/xfce/hm.nix new file mode 100644 index 00000000..08c65feb --- /dev/null +++ b/modules/xfce/hm.nix @@ -0,0 +1,18 @@ +{ pkgs, config, lib, ... }@args: + +{ + options.stylix.targets.xfce.enable = + config.lib.stylix.mkEnableTarget "Xfce" pkgs.stdenv.hostPlatform.isLinux; + + config = lib.mkIf config.stylix.targets.xfce.enable { + xfconf.settings = with config.stylix.fonts; { + xfwm4 = { + "general/title_font" = "${sansSerif.name} ${toString sizes.desktop}"; + }; + xsettings = { + "Gtk/FontName" = "${sansSerif.name} ${toString sizes.applications}"; + "Gtk/MonospaceFontName" = "${monospace.name} ${toString sizes.applications}"; + }; + }; + }; +} diff --git a/modules/xresources/hm.nix b/modules/xresources/hm.nix index 4bde9be8..c6c673fb 100644 --- a/modules/xresources/hm.nix +++ b/modules/xresources/hm.nix @@ -1,29 +1,33 @@ -{ pkgs, config, lib, ... }: +{ config, lib, ... }: -with config.stylix.fonts; - -let - themeFile = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-xresources"; - rev = "6711cf4fa61e903e52ef6eac186b83e04a0397d8"; - sha256 = "sha256-WazWviLhQRCyF9EBi2IDn9h8wrKc00PpqtltFDpUP5Q="; - }; - }; -in { options.stylix.targets.xresources.enable = config.lib.stylix.mkEnableTarget "Xresources" true; config = lib.mkIf config.stylix.targets.xresources.enable { - xresources = { - properties = { - "*.faceName" = monospace.name; - "*.faceSize" = sizes.terminal; - "*.renderFont" = true; - }; - extraConfig = builtins.readFile themeFile; + xresources.properties = with config.lib.stylix.colors.withHashtag; with config.stylix.fonts; { + "*.faceName" = monospace.name; + "*.faceSize" = sizes.terminal; + "*.renderFont" = true; + "*foreground" = base05; + "*background" = base00; + "*cursorColor" = base05; + "*color0" = base00; + "*color1" = base08; + "*color2" = base0B; + "*color3" = base0A; + "*color4" = base0D; + "*color5" = base0E; + "*color6" = base0C; + "*color7" = base05; + "*color8" = base03; + "*color9" = base09; + "*color10" = base01; + "*color11" = base02; + "*color12" = base04; + "*color13" = base06; + "*color14" = base0F; + "*color15" = base07; }; }; } diff --git a/modules/zathura/hm.nix b/modules/zathura/hm.nix index bc173b20..25b65098 100644 --- a/modules/zathura/hm.nix +++ b/modules/zathura/hm.nix @@ -29,8 +29,6 @@ with config.lib.stylix.colors; completion-highlight-bg = "#${base0D}"; recolor-lightcolor = "#${base00}"; recolor-darkcolor = "#${base06}"; - recolor = false; - recolor-keephue = false; }; }; } diff --git a/stylix/darwin/default.nix b/stylix/darwin/default.nix index 4852492a..31e495a0 100644 --- a/stylix/darwin/default.nix +++ b/stylix/darwin/default.nix @@ -1,3 +1,4 @@ +inputs: { palette-generator, base16, homeManagerModule }: { options, config, lib, ... }: @@ -10,6 +11,7 @@ in { ../target.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) + (import ../templates.nix inputs) ] ++ autoload; options.stylix.homeManagerIntegration = { diff --git a/stylix/hm/default.nix b/stylix/hm/default.nix index f000c891..4759035c 100644 --- a/stylix/hm/default.nix +++ b/stylix/hm/default.nix @@ -1,3 +1,4 @@ +inputs: { palette-generator, base16 }: { config, lib, ... }: @@ -10,5 +11,6 @@ in { ../opacity.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) + (import ../templates.nix inputs) ] ++ autoload; } diff --git a/stylix/nixos/default.nix b/stylix/nixos/default.nix index 283616e3..50a0308d 100644 --- a/stylix/nixos/default.nix +++ b/stylix/nixos/default.nix @@ -1,3 +1,4 @@ +inputs: { palette-generator, base16, homeManagerModule }: { options, config, lib, ... }: @@ -11,6 +12,7 @@ in { ../opacity.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) + (import ../templates.nix inputs) ] ++ autoload; options.stylix.homeManagerIntegration = { diff --git a/stylix/templates.nix b/stylix/templates.nix new file mode 100644 index 00000000..cc45be04 --- /dev/null +++ b/stylix/templates.nix @@ -0,0 +1,14 @@ +inputs: +{ + config.lib.stylix.templates = { + inherit (inputs) + base16-alacritty + base16-fish + base16-foot + base16-helix + base16-kitty + base16-tmux + base16-vim + ; + }; +}