treewide: clean up with and stuff (#975)

Fixes #973
This commit is contained in:
awwpotato 2025-03-18 05:10:02 -07:00 committed by GitHub
parent fa288c0dc6
commit ff9ae322bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 802 additions and 874 deletions

View file

@ -4,12 +4,6 @@
options, options,
... ...
}: }:
with config.lib.stylix.colors;
with config.stylix.fonts;
let
aviOpacity = toString config.stylix.opacity.popups;
in
{ {
options.stylix.targets.avizo.enable = options.stylix.targets.avizo.enable =
config.lib.stylix.mkEnableTarget "Avizo" true; config.lib.stylix.mkEnableTarget "Avizo" true;
@ -19,12 +13,12 @@ in
lib.mkIf (config.stylix.enable && config.stylix.targets.avizo.enable) { lib.mkIf (config.stylix.enable && config.stylix.targets.avizo.enable) {
services.avizo = { services.avizo = {
settings = { settings = {
default = { default = with config.lib.stylix.colors; {
background = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})"; background = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})";
border-color = "rgba(${base0D-rgb-r}, ${base0D-rgb-g}, ${base0D-rgb-b}, ${aviOpacity})"; border-color = "rgba(${base0D-rgb-r}, ${base0D-rgb-g}, ${base0D-rgb-b}, ${aviOpacity})";
bar-fg-color = "rgba(${base05-rgb-r}, ${base05-rgb-g}, ${base05-rgb-b}, ${aviOpacity})"; bar-fg-color = "rgba(${base05-rgb-r}, ${base05-rgb-g}, ${base05-rgb-b}, ${aviOpacity})";
bar-bg-color = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})"; bar-bg-color = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})";
image-opacity = aviOpacity; image-opacity = toString config.stylix.opacity.popups;
}; };
}; };
}; };

View file

@ -1,12 +1,4 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
let
bemenuOpacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
);
in
{ {
options.stylix.targets.bemenu = { options.stylix.targets.bemenu = {
enable = config.lib.stylix.mkEnableTarget "bemenu" true; enable = config.lib.stylix.mkEnableTarget "bemenu" true;
@ -16,7 +8,7 @@ in
Font size used for bemenu. Font size used for bemenu.
''; '';
type = with lib.types; nullOr int; type = with lib.types; nullOr int;
default = sizes.popups; default = config.stylix.fonts.sizes.popups;
}; # optional argument }; # optional argument
alternate = lib.mkOption { alternate = lib.mkOption {
@ -31,28 +23,37 @@ in
config = config =
lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable) lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable)
{ {
programs.bemenu.settings = with config.stylix.targets.bemenu; { programs.bemenu.settings =
tb = "${base01}${bemenuOpacity}"; # Title bg with config.lib.stylix.colors.withHashtag;
nb = "${base01}${bemenuOpacity}"; # Normal bg with config.stylix.fonts;
fb = "${base01}${bemenuOpacity}"; # Filter bg with config.stylix.targets.bemenu;
hb = "${base03}${bemenuOpacity}"; # Highlighted bg let
sb = "${base03}${bemenuOpacity}"; # Selected bg bemenuOpacity = lib.toHexString (
scb = "${base01}"; # Scrollbar bg ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
);
in
{
tb = "${base01}${bemenuOpacity}"; # Title bg
nb = "${base01}${bemenuOpacity}"; # Normal bg
fb = "${base01}${bemenuOpacity}"; # Filter bg
hb = "${base03}${bemenuOpacity}"; # Highlighted bg
sb = "${base03}${bemenuOpacity}"; # Selected bg
scb = "${base01}"; # Scrollbar bg
hf = "${base0A}"; # Highlighted fg hf = "${base0A}"; # Highlighted fg
sf = "${base0B}"; # Selected fg sf = "${base0B}"; # Selected fg
tf = "${base05}"; # Title fg tf = "${base05}"; # Title fg
ff = "${base05}"; # Filter fg ff = "${base05}"; # Filter fg
nf = "${base05}"; # Normal fg nf = "${base05}"; # Normal fg
scf = "${base03}"; # Scrollbar fg scf = "${base03}"; # Scrollbar fg
ab = "${if alternate then base00 else base01}"; # Alternate bg ab = "${if alternate then base00 else base01}"; # Alternate bg
af = "${if alternate then base04 else base05}"; # Alternate fg af = "${if alternate then base04 else base05}"; # Alternate fg
# Font name # Font name
fn = "${sansSerif.name} ${ fn = "${sansSerif.name} ${
lib.optionalString (fontSize != null) (builtins.toString fontSize) lib.optionalString (fontSize != null) (builtins.toString fontSize)
}"; }";
}; };
}; };
} }

View file

@ -1,18 +1,15 @@
{ config, lib, ... }: { config, lib, ... }:
let
colors = config.lib.stylix.colors.withHashtag;
in
{ {
options.stylix.targets.bspwm.enable = options.stylix.targets.bspwm.enable =
config.lib.stylix.mkEnableTarget "bspwm" true; config.lib.stylix.mkEnableTarget "bspwm" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bspwm.enable) { config = lib.mkIf (config.stylix.enable && config.stylix.targets.bspwm.enable) {
xsession.windowManager.bspwm.settings = { xsession.windowManager.bspwm.settings =
normal_border_color = colors.base03; with config.lib.stylix.colors.withHashtag; {
active_border_color = colors.base0C; normal_border_color = base03;
focused_border_color = colors.base0D; active_border_color = base0C;
presel_feedback_color = colors.base00; focused_border_color = base0D;
}; presel_feedback_color = base00;
};
}; };
} }

View file

@ -1,8 +1,4 @@
{ config, lib, ... }: { config, lib, ... }:
let
colors = config.lib.stylix.colors.withHashtag;
in
{ {
options.stylix.targets.btop.enable = options.stylix.targets.btop.enable =
config.lib.stylix.mkEnableTarget "btop" true; config.lib.stylix.mkEnableTarget "btop" true;
@ -21,50 +17,51 @@ in
theme_background = lib.mkIf (config.stylix.opacity.terminal != 1.0) false; theme_background = lib.mkIf (config.stylix.opacity.terminal != 1.0) false;
}; };
xdg.configFile."btop/themes/stylix.theme".text = with colors; '' xdg.configFile."btop/themes/stylix.theme".text =
#Generated by Stylix with config.lib.stylix.colors.withHashtag; ''
theme[main_bg]="${base00}" #Generated by Stylix
theme[main_fg]="${base05}" theme[main_bg]="${base00}"
theme[title]="${base05}" theme[main_fg]="${base05}"
theme[hi_fg]="${base0D}" theme[title]="${base05}"
theme[selected_bg]="${base03}" theme[hi_fg]="${base0D}"
theme[selected_fg]="${base0D}" theme[selected_bg]="${base03}"
theme[inactive_fg]="${base04}" theme[selected_fg]="${base0D}"
theme[graph_text]="${base06}" theme[inactive_fg]="${base04}"
theme[meter_bg]="${base03}" theme[graph_text]="${base06}"
theme[proc_misc]="${base06}" theme[meter_bg]="${base03}"
theme[cpu_box]="${base0E}" theme[proc_misc]="${base06}"
theme[mem_box]="${base0B}" theme[cpu_box]="${base0E}"
theme[net_box]="${base0C}" theme[mem_box]="${base0B}"
theme[proc_box]="${base0D}" theme[net_box]="${base0C}"
theme[div_line]="${base01}" theme[proc_box]="${base0D}"
theme[temp_start]="${base0B}" theme[div_line]="${base01}"
theme[temp_mid]="${base0A}" theme[temp_start]="${base0B}"
theme[temp_end]="${base08}" theme[temp_mid]="${base0A}"
theme[cpu_start]="${base0B}" theme[temp_end]="${base08}"
theme[cpu_mid]="${base0A}" theme[cpu_start]="${base0B}"
theme[cpu_end]="${base08}" theme[cpu_mid]="${base0A}"
theme[free_start]="${base0A}" theme[cpu_end]="${base08}"
theme[free_mid]="${base0B}" theme[free_start]="${base0A}"
theme[free_end]="${base0B}" theme[free_mid]="${base0B}"
theme[cached_start]="${base0C}" theme[free_end]="${base0B}"
theme[cached_mid]="${base0C}" theme[cached_start]="${base0C}"
theme[cached_end]="${base0A}" theme[cached_mid]="${base0C}"
theme[available_start]="${base08}" theme[cached_end]="${base0A}"
theme[available_mid]="${base0A}" theme[available_start]="${base08}"
theme[available_end]="${base0B}" theme[available_mid]="${base0A}"
theme[used_start]="${base0A}" theme[available_end]="${base0B}"
theme[used_mid]="${base09}" theme[used_start]="${base0A}"
theme[used_end]="${base08}" theme[used_mid]="${base09}"
theme[download_start]="${base0B}" theme[used_end]="${base08}"
theme[download_mid]="${base0A}" theme[download_start]="${base0B}"
theme[download_end]="${base08}" theme[download_mid]="${base0A}"
theme[upload_start]="${base0B}" theme[download_end]="${base08}"
theme[upload_mid]="${base0A}" theme[upload_start]="${base0B}"
theme[upload_end]="${base08}" theme[upload_mid]="${base0A}"
theme[process_start]="${base0B}" theme[upload_end]="${base08}"
theme[process_mid]="${base0A}" theme[process_start]="${base0B}"
theme[process_end]="${base08}" theme[process_mid]="${base0A}"
''; theme[process_end]="${base08}"
'';
}; };
} }

View file

@ -1,29 +1,26 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors;
{ {
options.stylix.targets.console.enable = options.stylix.targets.console.enable =
config.lib.stylix.mkEnableTarget "the Linux kernel console" true; config.lib.stylix.mkEnableTarget "the Linux kernel console" true;
config.console.colors = config.console.colors =
lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable) with config.lib.stylix.colors;
[ lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable) [
base00-hex base00-hex
red red
green green
yellow yellow
blue blue
magenta magenta
cyan cyan
base05-hex base05-hex
base03-hex base03-hex
red red
green green
yellow yellow
blue blue
magenta magenta
cyan cyan
base06-hex base06-hex
]; ];
} }

View file

@ -6,12 +6,10 @@
... ...
}: }:
let let
template = template = import ./template.nix {
let inherit (config.lib.stylix) colors;
inherit (config.lib.stylix) colors; inherit (config.stylix) fonts;
inherit (config.stylix) fonts; };
in
import ./template.nix { inherit colors fonts; };
in in
{ {
options.stylix.targets = options.stylix.targets =

View file

@ -1,7 +1,4 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
let let
dunstOpacity = lib.toHexString ( dunstOpacity = lib.toHexString (
((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100 ((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100
@ -12,10 +9,10 @@ in
config.lib.stylix.mkEnableTarget "Dunst" true; config.lib.stylix.mkEnableTarget "Dunst" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) { config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) {
services.dunst.settings = { services.dunst.settings = with config.lib.stylix.colors.withHashtag; {
global = { global = {
separator_color = base02; separator_color = base02;
font = "${sansSerif.name} ${toString sizes.popups}"; font = with config.stylix.fonts; "${sansSerif.name} ${toString sizes.popups}";
}; };
urgency_low = { urgency_low = {

View file

@ -4,15 +4,12 @@
lib, lib,
... ...
}: }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
let let
inherit (config.stylix) fonts;
emacsOpacity = builtins.toString ( emacsOpacity = builtins.toString (
builtins.ceil (config.stylix.opacity.applications * 100) builtins.ceil (config.stylix.opacity.applications * 100)
); );
emacsSize = builtins.toString (sizes.terminal * 1.0); emacsSize = builtins.toString (fonts.sizes.terminal * 1.0);
in in
{ {
options.stylix.targets.emacs.enable = options.stylix.targets.emacs.enable =
@ -21,49 +18,52 @@ in
config = lib.mkIf (config.stylix.enable && config.stylix.targets.emacs.enable) { config = lib.mkIf (config.stylix.enable && config.stylix.targets.emacs.enable) {
programs.emacs = { programs.emacs = {
extraPackages = epkgs: [ extraPackages = epkgs: [
(epkgs.trivialBuild { (epkgs.trivialBuild (
pname = "base16-stylix-theme"; with config.lib.stylix.colors.withHashtag;
version = "0.1.0"; {
src = pkgs.writeText "base16-stylix-theme.el" '' pname = "base16-stylix-theme";
(require 'base16-theme) version = "0.1.0";
src = pkgs.writeText "base16-stylix-theme.el" ''
(require 'base16-theme)
(defvar base16-stylix-theme-colors (defvar base16-stylix-theme-colors
'(:base00 "${base00}" '(:base00 "${base00}"
:base01 "${base01}" :base01 "${base01}"
:base02 "${base02}" :base02 "${base02}"
:base03 "${base03}" :base03 "${base03}"
:base04 "${base04}" :base04 "${base04}"
:base05 "${base05}" :base05 "${base05}"
:base06 "${base06}" :base06 "${base06}"
:base07 "${base07}" :base07 "${base07}"
:base08 "${base08}" :base08 "${base08}"
:base09 "${base09}" :base09 "${base09}"
:base0A "${base0A}" :base0A "${base0A}"
:base0B "${base0B}" :base0B "${base0B}"
:base0C "${base0C}" :base0C "${base0C}"
:base0D "${base0D}" :base0D "${base0D}"
:base0E "${base0E}" :base0E "${base0E}"
:base0F "${base0F}") :base0F "${base0F}")
"All colors for Base16 stylix are defined here.") "All colors for Base16 stylix are defined here.")
;; Define the theme ;; Define the theme
(deftheme base16-stylix) (deftheme base16-stylix)
;; Add all the faces to the theme ;; Add all the faces to the theme
(base16-theme-define 'base16-stylix base16-stylix-theme-colors) (base16-theme-define 'base16-stylix base16-stylix-theme-colors)
;; Mark the theme as provided ;; Mark the theme as provided
(provide-theme 'base16-stylix) (provide-theme 'base16-stylix)
;; Add path to theme to theme-path ;; Add path to theme to theme-path
(add-to-list 'custom-theme-load-path (add-to-list 'custom-theme-load-path
(file-name-directory (file-name-directory
(file-truename load-file-name))) (file-truename load-file-name)))
(provide 'base16-stylix-theme) (provide 'base16-stylix-theme)
''; '';
packageRequires = [ epkgs.base16-theme ]; packageRequires = [ epkgs.base16-theme ];
}) }
))
]; ];
extraConfig = '' extraConfig = ''
@ -72,7 +72,7 @@ in
(setq base16-theme-256-color-source 'colors) (setq base16-theme-256-color-source 'colors)
(load-theme 'base16-stylix t) (load-theme 'base16-stylix t)
;; Set font ;; Set font
(set-face-attribute 'default nil :font (font-spec :family "${monospace.name}" :size ${emacsSize})) (set-face-attribute 'default nil :font (font-spec :family "${fonts.monospace.name}" :size ${emacsSize}))
;; ----------------------------- ;; -----------------------------
;; set opacity ;; set opacity
(add-to-list 'default-frame-alist '(alpha-background . ${emacsOpacity})) (add-to-list 'default-frame-alist '(alpha-background . ${emacsOpacity}))

View file

@ -1,18 +1,14 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.stylix.targets.foot;
theme = config.lib.stylix.colors { theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.tinted-foot; templateRepo = config.stylix.inputs.tinted-foot;
}; };
in in
{ {
options.stylix.targets.foot.enable = options.stylix.targets.foot.enable =
config.lib.stylix.mkEnableTarget "Foot" true; config.lib.stylix.mkEnableTarget "Foot" true;
config.programs.foot.settings = lib.mkIf cfg.enable { config.programs.foot.settings = lib.mkIf config.stylix.targets.foot.enable {
main = { main = {
include = theme; include = theme;
font = font =
@ -20,6 +16,6 @@ in
"${monospace.name}:size=${toString sizes.terminal}"; "${monospace.name}:size=${toString sizes.terminal}";
dpi-aware = "no"; dpi-aware = "no";
}; };
colors.alpha = with config.stylix.opacity; terminal; colors.alpha = config.stylix.opacity.terminal;
}; };
} }

View file

@ -1,10 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors;
let let
opacity = lib.toHexString (builtins.ceil (config.stylix.opacity.popups * 255)); opacity = lib.toHexString (builtins.ceil (config.stylix.opacity.popups * 255));
in in
{ {
options.stylix.targets.fuzzel.enable = options.stylix.targets.fuzzel.enable =
@ -13,7 +9,7 @@ in
config.programs.fuzzel.settings = config.programs.fuzzel.settings =
lib.mkIf (config.stylix.enable && config.stylix.targets.fuzzel.enable) lib.mkIf (config.stylix.enable && config.stylix.targets.fuzzel.enable)
{ {
colors = { colors = with config.lib.stylix.colors; {
background = "${base00-hex}${opacity}"; background = "${base00-hex}${opacity}";
text = "${base05-hex}ff"; text = "${base05-hex}ff";
placeholder = "${base03-hex}ff"; placeholder = "${base03-hex}ff";

View file

@ -5,12 +5,9 @@
... ...
}: }:
with config.lib.stylix;
with config.stylix.fonts;
with config.lib.stylix.colors.withHashtag;
let let
cfg = config.stylix.targets.grub; cfg = config.stylix.targets.grub;
inherit (config.stylix) imageScalingMode fonts;
# Grub requires fonts to be converted to "PFF2 format" # Grub requires fonts to be converted to "PFF2 format"
# This function takes a font { name, package } and produces a .pf2 file # This function takes a font { name, package } and produces a .pf2 file
mkGrubFont = mkGrubFont =
@ -28,11 +25,9 @@ let
) )
# Convert to .pf2 # Convert to .pf2
${pkgs.grub2}/bin/grub-mkfont $font --output $out --size ${toString sizes.applications} ${pkgs.grub2}/bin/grub-mkfont $font --output $out --size ${toString fonts.sizes.applications}
''; '';
inherit (config.stylix) imageScalingMode;
image-scale = image-scale =
if imageScalingMode == "fill" then if imageScalingMode == "fill" then
"crop" "crop"
@ -62,90 +57,94 @@ in
]; ];
}) })
]; ];
options.stylix.targets.grub = { options.stylix.targets.grub = with config.lib.stylix; {
enable = config.lib.stylix.mkEnableTarget "GRUB" true; enable = mkEnableTarget "GRUB" true;
useWallpaper = config.lib.stylix.mkEnableWallpaper "GRUB" false; useWallpaper = mkEnableWallpaper "GRUB" false;
}; };
config.boot.loader.grub = lib.mkIf (config.stylix.enable && cfg.enable) { config.boot.loader.grub =
backgroundColor = base00; with config.lib.stylix.colors.withHashtag;
# Need to override the NixOS splash, this will match the background with config.lib.stylix;
splashImage = pixel "base00"; with config.stylix.fonts;
lib.mkIf (config.stylix.enable && cfg.enable) {
backgroundColor = base00;
# Need to override the NixOS splash, this will match the background
splashImage = pixel "base00";
# This font will be used for the GRUB terminal # This font will be used for the GRUB terminal
font = toString (mkGrubFont monospace); font = toString (mkGrubFont fonts.monospace);
# TODO: Include OS icons # TODO: Include OS icons
theme = theme =
pkgs.runCommand "stylix-grub" pkgs.runCommand "stylix-grub"
{ {
themeTxt = '' themeTxt = ''
desktop-image: "background.png" desktop-image: "background.png"
desktop-image-scale-method: "${image-scale}" desktop-image-scale-method: "${image-scale}"
desktop-color: "${base00}" desktop-color: "${base00}"
title-text: "" title-text: ""
terminal-left: "10%" terminal-left: "10%"
terminal-top: "20%" terminal-top: "20%"
terminal-width: "80%" terminal-width: "80%"
terminal-height: "60%" terminal-height: "60%"
+ progress_bar { + progress_bar {
left = 25% left = 25%
top = 80%+20 # 20 pixels below boot menu top = 80%+20 # 20 pixels below boot menu
width = 50% width = 50%
height = 30 height = 30
id = "__timeout__" id = "__timeout__"
show_text = true show_text = true
font = "${sansSerif.name}" font = "${fonts.sansSerif.name}"
text = "@TIMEOUT_NOTIFICATION_MIDDLE@" text = "@TIMEOUT_NOTIFICATION_MIDDLE@"
border_color = "${base00}" border_color = "${base00}"
bg_color = "${base00}" bg_color = "${base00}"
fg_color = "${base0B}" fg_color = "${base0B}"
text_color = "${base05}" text_color = "${base05}"
} }
+ boot_menu { + boot_menu {
left = 25% left = 25%
top = 20% top = 20%
width = 50% width = 50%
height = 60% height = 60%
menu_pixmap_style = "background_*.png" menu_pixmap_style = "background_*.png"
item_height = 40 item_height = 40
item_icon_space = 8 item_icon_space = 8
item_spacing = 0 item_spacing = 0
item_padding = 0 item_padding = 0
item_font = "${sansSerif.name}" item_font = "${fonts.sansSerif.name}"
item_color = "${base05}" item_color = "${base05}"
selected_item_color = "${base01}" selected_item_color = "${base01}"
selected_item_pixmap_style = "selection_*.png" selected_item_pixmap_style = "selection_*.png"
} }
''; '';
passAsFile = [ "themeTxt" ]; passAsFile = [ "themeTxt" ];
}
''
mkdir $out
cp $themeTxtPath $out/theme.txt
${
if
cfg.useWallpaper
# Make sure the background image is .png by asking to convert it
then
"${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png"
else
"cp ${pixel "base00"} $out/background.png"
} }
''
mkdir $out
cp $themeTxtPath $out/theme.txt
cp ${pixel "base01"} $out/background_c.png ${
cp ${pixel "base0B"} $out/selection_c.png if
cfg.useWallpaper
# Make sure the background image is .png by asking to convert it
then
"${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png"
else
"cp ${pixel "base00"} $out/background.png"
}
cp ${mkGrubFont sansSerif} $out/sans_serif.pf2 cp ${pixel "base01"} $out/background_c.png
''; cp ${pixel "base0B"} $out/selection_c.png
};
cp ${mkGrubFont sansSerif} $out/sans_serif.pf2
'';
};
} }

View file

@ -1,23 +1,20 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix;
let let
cfg = config.stylix.targets.hyprlock; cfg = config.stylix.targets.hyprlock;
in in
{ {
options.stylix.targets.hyprlock = { options.stylix.targets.hyprlock = with config.lib.stylix; {
enable = mkEnableTarget "Hyprlock" true; enable = mkEnableTarget "Hyprlock" true;
useWallpaper = mkEnableWallpaper "Hyprlock" true; useWallpaper = mkEnableWallpaper "Hyprlock" true;
}; };
config = lib.mkIf (config.stylix.enable && cfg.enable) { config = lib.mkIf (config.stylix.enable && cfg.enable) {
programs.hyprlock.settings = { programs.hyprlock.settings = with config.lib.stylix.colors; {
background = { background = {
color = "rgb(${colors.base00})"; color = "rgb(${base00})";
path = lib.mkIf cfg.useWallpaper "${config.stylix.image}"; path = lib.mkIf cfg.useWallpaper "${config.stylix.image}";
}; };
input-field = with colors; { input-field = {
outer_color = "rgb(${base03})"; outer_color = "rgb(${base03})";
inner_color = "rgb(${base00})"; inner_color = "rgb(${base00})";
font_color = "rgb(${base05})"; font_color = "rgb(${base05})";

View file

@ -1,13 +1,5 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
let let
text = base05;
urgent = base08;
focused = base0D;
unfocused = base03;
fonts = fonts =
let let
inherit (config.stylix) fonts; inherit (config.stylix) fonts;
@ -16,89 +8,96 @@ let
names = [ fonts.sansSerif.name ]; names = [ fonts.sansSerif.name ];
size = fonts.sizes.desktop * 1.0; size = fonts.sizes.desktop * 1.0;
}; };
in in
{ {
options.stylix.targets.i3.enable = config.lib.stylix.mkEnableTarget "i3" true; options.stylix.targets.i3.enable = config.lib.stylix.mkEnableTarget "i3" true;
config = lib.mkMerge [ config =
(lib.mkIf config.stylix.targets.i3.enable { with config.lib.stylix.colors.withHashtag;
xsession.windowManager.i3.config = { let
inherit fonts; text = base05;
urgent = base08;
focused = base0D;
unfocused = base03;
in
lib.mkMerge [
(lib.mkIf config.stylix.targets.i3.enable {
xsession.windowManager.i3.config = {
inherit fonts;
colors = colors =
let let
background = base00; background = base00;
indicator = base0B; indicator = base0B;
in in
{ {
inherit background; inherit background;
urgent = { urgent = {
inherit background indicator text; inherit background indicator text;
border = urgent; border = urgent;
childBorder = urgent; childBorder = urgent;
};
focused = {
inherit background indicator text;
border = focused;
childBorder = focused;
};
focusedInactive = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
unfocused = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
placeholder = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
}; };
focused = {
inherit background indicator text;
border = focused;
childBorder = focused;
};
focusedInactive = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
unfocused = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
placeholder = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
};
# output."*".bg = "${config.stylix.image} fill"; # output."*".bg = "${config.stylix.image} fill";
}; };
}) })
{ {
# Merge this with your bar configuration using //config.lib.stylix.i3.bar # Merge this with your bar configuration using //config.lib.stylix.i3.bar
lib.stylix.i3.bar = { lib.stylix.i3.bar = {
inherit fonts; inherit fonts;
colors = colors =
let let
background = base00; background = base00;
border = background; border = background;
in in
{ {
inherit background; inherit background;
statusline = text; statusline = text;
separator = base03; separator = base03;
focusedWorkspace = { focusedWorkspace = {
inherit text background; inherit text background;
border = focused; border = focused;
};
activeWorkspace = {
inherit border background;
text = focused;
};
inactiveWorkspace = {
inherit text border background;
};
urgentWorkspace = {
inherit text background;
border = urgent;
};
bindingMode = {
inherit text border;
background = urgent;
};
}; };
activeWorkspace = { };
inherit border background; }
text = focused; ];
};
inactiveWorkspace = {
inherit text border background;
};
urgentWorkspace = {
inherit text background;
border = urgent;
};
bindingMode = {
inherit text border;
background = urgent;
};
};
};
}
];
} }

View file

@ -1,22 +1,19 @@
{ config, lib, ... }: { config, ... }:
let
colors = config.lib.stylix.colors.withHashtag;
in
{ {
# Merge this with your bar's theme's overrides with //config.lib.stylix.i3status-rust.bar # Merge this with your bar's theme's overrides with //config.lib.stylix.i3status-rust.bar
config.lib.stylix.i3status-rust.bar = with colors; { config.lib.stylix.i3status-rust.bar =
idle_bg = base00; with config.lib.stylix.colors.withHashtag; {
idle_fg = base05; idle_bg = base00;
info_bg = base09; idle_fg = base05;
info_fg = base00; info_bg = base09;
good_bg = base01; info_fg = base00;
good_fg = base05; good_bg = base01;
warning_bg = base0A; good_fg = base05;
warning_fg = base00; warning_bg = base0A;
critical_bg = base08; warning_fg = base00;
critical_fg = base00; critical_bg = base08;
separator_bg = base00; critical_fg = base00;
separator_fg = base05; separator_bg = base00;
}; separator_fg = base05;
};
} }

View file

@ -1,12 +1,9 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
{ {
options.stylix.targets.k9s.enable = config.lib.stylix.mkEnableTarget "k9s" true; options.stylix.targets.k9s.enable = config.lib.stylix.mkEnableTarget "k9s" true;
config = lib.mkIf config.stylix.targets.k9s.enable { config = lib.mkIf config.stylix.targets.k9s.enable {
programs.k9s.skins.skin = { programs.k9s.skins.skin = with config.lib.stylix.colors.withHashtag; {
k9s = { k9s = {
body = { body = {
fgColor = base05-hex; fgColor = base05-hex;

View file

@ -7,66 +7,66 @@
programs.kubecolor.settings = { programs.kubecolor.settings = {
preset = preset =
if config.stylix.polarity == "either" then "" else "${config.stylix.polarity}"; if config.stylix.polarity == "either" then "" else "${config.stylix.polarity}";
theme = { theme = with config.lib.stylix.colors.withHashtag; {
base = { base = {
info = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; info = "fg=${base05-hex}";
primary = "fg=${config.lib.stylix.colors.withHashtag.base0E-hex}"; primary = "fg=${base0E-hex}";
secondary = "fg=${config.lib.stylix.colors.withHashtag.base0D-hex}"; secondary = "fg=${base0D-hex}";
success = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}:bold"; success = "fg=${base0B-hex}:bold";
warning = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}:bold"; warning = "fg=${base0A-hex}:bold";
danger = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; danger = "fg=${base08-hex}:bold";
muted = "fg=${config.lib.stylix.colors.withHashtag.base04-hex}"; muted = "fg=${base04-hex}";
key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; key = "fg=${base07-hex}:bold";
}; };
default = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; default = "fg=${base05-hex}";
data = { data = {
key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; key = "fg=${base07-hex}:bold";
string = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; string = "fg=${base05-hex}";
true = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}:bold"; true = "fg=${base0B-hex}:bold";
false = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; false = "fg=${base08-hex}:bold";
number = "fg=${config.lib.stylix.colors.withHashtag.base0E-hex}"; number = "fg=${base0E-hex}";
null = "fg=${config.lib.stylix.colors.withHashtag.base04-hex}"; null = "fg=${base04-hex}";
quantity = "fg=${config.lib.stylix.colors.withHashtag.base0E-hex}"; quantity = "fg=${base0E-hex}";
duration = "fg=${config.lib.stylix.colors.withHashtag.base09-hex}"; duration = "fg=${base09-hex}";
durationfresh = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}"; durationfresh = "fg=${base0B-hex}";
ratio = { ratio = {
zero = "fg=${config.lib.stylix.colors.withHashtag.base04-hex}"; zero = "fg=${base04-hex}";
equal = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}"; equal = "fg=${base0B-hex}";
unequal = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}"; unequal = "fg=${base0A-hex}";
}; };
}; };
status = { status = {
success = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}:bold"; success = "fg=${base0B-hex}:bold";
warning = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}:bold"; warning = "fg=${base0A-hex}:bold";
error = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; error = "fg=${base08-hex}:bold";
}; };
table = { table = {
header = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}:bold"; header = "fg=${base05-hex}:bold";
columns = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; columns = "fg=${base05-hex}";
}; };
stderr = { stderr = {
default = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; default = "fg=${base05-hex}";
error = "fg=${config.lib.stylix.colors.withHashtag.base08-hex}:bold"; error = "fg=${base08-hex}:bold";
}; };
describe = { describe = {
key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; key = "fg=${base07-hex}:bold";
}; };
apply = { apply = {
created = "fg=${config.lib.stylix.colors.withHashtag.base0B-hex}"; created = "fg=${base0B-hex}";
configured = "fg=${config.lib.stylix.colors.withHashtag.base0A-hex}"; configured = "fg=${base0A-hex}";
unchanged = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; unchanged = "fg=${base05-hex}";
dryrun = "fg=${config.lib.stylix.colors.withHashtag.base0D-hex}"; dryrun = "fg=${base0D-hex}";
fallback = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; fallback = "fg=${base05-hex}";
}; };
explain = { explain = {
key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; key = "fg=${base07-hex}:bold";
required = "fg=${config.lib.stylix.colors.withHashtag.base00-hex}:bold"; required = "fg=${base00-hex}:bold";
}; };
options = { options = {
flag = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; flag = "fg=${base07-hex}:bold";
}; };
version = { version = {
key = "fg=${config.lib.stylix.colors.withHashtag.base07-hex}:bold"; key = "fg=${base07-hex}:bold";
}; };
}; };
}; };

View file

@ -4,9 +4,6 @@
options, options,
... ...
}: }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
let let
makoOpacity = lib.toHexString ( makoOpacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100 ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
@ -19,25 +16,28 @@ in
# Referenced https://github.com/stacyharper/base16-mako # Referenced https://github.com/stacyharper/base16-mako
config = lib.optionalAttrs (options.services ? mako) ( config = lib.optionalAttrs (options.services ? mako) (
lib.mkIf (config.stylix.enable && config.stylix.targets.mako.enable) { lib.mkIf (config.stylix.enable && config.stylix.targets.mako.enable) {
services.mako = { services.mako =
backgroundColor = base00 + makoOpacity; with config.lib.stylix.colors.withHashtag;
borderColor = base0D; with config.stylix.fonts;
textColor = base05; {
progressColor = "over ${base02}"; backgroundColor = base00 + makoOpacity;
font = "${sansSerif.name} ${toString sizes.popups}"; borderColor = base0D;
# I wish the mako hm module was like the dunst one textColor = base05;
extraConfig = '' progressColor = "over ${base02}";
[urgency=low] font = "${sansSerif.name} ${toString sizes.popups}";
background-color=${base00}${makoOpacity} # I wish the mako hm module was like the dunst one
border-color=${base0D} extraConfig = ''
text-color=${base0A} [urgency=low]
background-color=${base00}${makoOpacity}
border-color=${base0D}
text-color=${base0A}
[urgency=high] [urgency=high]
background-color=${base00}${makoOpacity} background-color=${base00}${makoOpacity}
border-color=${base0D} border-color=${base0D}
text-color=${base08} text-color=${base08}
''; '';
}; };
} }
); );
} }

View file

@ -1,8 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
let let
inherit (config.stylix) fonts opacity; inherit (config.stylix) fonts opacity;
inherit (config.lib.stylix) colors;
in in
{ {
options.stylix.targets.mangohud.enable = options.stylix.targets.mangohud.enable =
@ -11,7 +9,7 @@ in
config = config =
lib.mkIf (config.stylix.enable && config.stylix.targets.mangohud.enable) lib.mkIf (config.stylix.enable && config.stylix.targets.mangohud.enable)
{ {
programs.mangohud.settings = with colors; { programs.mangohud.settings = with config.lib.stylix.colors; {
font_size = fonts.sizes.applications; font_size = fonts.sizes.applications;
font_size_text = fonts.sizes.applications; font_size_text = fonts.sizes.applications;
background_alpha = opacity.popups; background_alpha = opacity.popups;

View file

@ -7,32 +7,28 @@
config = config =
lib.mkIf (config.stylix.enable && config.stylix.targets.ncspot.enable) lib.mkIf (config.stylix.enable && config.stylix.targets.ncspot.enable)
{ {
programs.ncspot.settings = programs.ncspot.settings = {
let theme = with config.lib.stylix.colors.withHashtag; {
colors = config.lib.stylix.colors.withHashtag; background =
in if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00;
{ primary = base05;
theme = with colors; { secondary = base04;
background = title = base06;
if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00; playing = base0B;
primary = base05; playing_selected = base0B;
secondary = base04; playing_bg =
title = base06; if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00;
playing = base0B; highlight = base05;
playing_selected = base0B; highlight_bg = base02;
playing_bg = error = base05;
if (config.stylix.opacity.terminal != 1.0) then "#00000000" else base00; error_bg = base08;
highlight = base05; statusbar = base00;
highlight_bg = base02; statusbar_progress = base04;
error = base05; statusbar_bg = base04;
error_bg = base08; cmdline = base02;
statusbar = base00; cmdline_bg = base05;
statusbar_progress = base04; search_match = base05;
statusbar_bg = base04;
cmdline = base02;
cmdline_bg = base05;
search_match = base05;
};
}; };
};
}; };
} }

View file

@ -4,9 +4,6 @@
lib, lib,
... ...
}: }:
with config.lib.stylix.colors;
{ {
options.stylix.targets.nixos-icons.enable = options.stylix.targets.nixos-icons.enable =
config.lib.stylix.mkEnableTarget "the NixOS logo" true; config.lib.stylix.mkEnableTarget "the NixOS logo" true;
@ -18,7 +15,7 @@ with config.lib.stylix.colors;
nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: { nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: {
src = pkgs.applyPatches { src = pkgs.applyPatches {
inherit (oldAttrs) src; inherit (oldAttrs) src;
prePatch = '' prePatch = with config.lib.stylix.colors; ''
substituteInPlace logo/nix-snowflake-white.svg --replace-fail '#ffffff' '#${base05}' substituteInPlace logo/nix-snowflake-white.svg --replace-fail '#ffffff' '#${base05}'
# Insert attribution comment after the XML prolog # Insert attribution comment after the XML prolog

View file

@ -1,50 +1,47 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
{ {
options.stylix.targets.nushell.enable = options.stylix.targets.nushell.enable =
config.lib.stylix.mkEnableTarget "Nushell" true; config.lib.stylix.mkEnableTarget "Nushell" true;
# Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming # Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming
config.programs.nushell.extraConfig = config.programs.nushell.extraConfig =
lib.mkIf (config.stylix.enable && config.stylix.targets.nushell.enable) with config.lib.stylix.colors.withHashtag;
'' lib.mkIf (config.stylix.enable && config.stylix.targets.nushell.enable) ''
$env.config.color_config = { $env.config.color_config = {
separator: "${base03}" separator: "${base03}"
leading_trailing_space_bg: "${base04}" leading_trailing_space_bg: "${base04}"
header: "${base0B}" header: "${base0B}"
date: "${base0E}" date: "${base0E}"
filesize: "${base0D}" filesize: "${base0D}"
row_index: "${base0C}" row_index: "${base0C}"
bool: "${base08}" bool: "${base08}"
int: "${base0B}" int: "${base0B}"
duration: "${base08}" duration: "${base08}"
range: "${base08}" range: "${base08}"
float: "${base08}" float: "${base08}"
string: "${base04}" string: "${base04}"
nothing: "${base08}" nothing: "${base08}"
binary: "${base08}" binary: "${base08}"
cellpath: "${base08}" cellpath: "${base08}"
hints: dark_gray hints: dark_gray
shape_garbage: { fg: "${base07}" bg: "${base08}" } shape_garbage: { fg: "${base07}" bg: "${base08}" }
shape_bool: "${base0D}" shape_bool: "${base0D}"
shape_int: { fg: "${base0E}" attr: b } shape_int: { fg: "${base0E}" attr: b }
shape_float: { fg: "${base0E}" attr: b } shape_float: { fg: "${base0E}" attr: b }
shape_range: { fg: "${base0A}" attr: b } shape_range: { fg: "${base0A}" attr: b }
shape_internalcall: { fg: "${base0C}" attr: b } shape_internalcall: { fg: "${base0C}" attr: b }
shape_external: "${base0C}" shape_external: "${base0C}"
shape_externalarg: { fg: "${base0B}" attr: b } shape_externalarg: { fg: "${base0B}" attr: b }
shape_literal: "${base0D}" shape_literal: "${base0D}"
shape_operator: "${base0A}" shape_operator: "${base0A}"
shape_signature: { fg: "${base0B}" attr: b } shape_signature: { fg: "${base0B}" attr: b }
shape_string: "${base0B}" shape_string: "${base0B}"
shape_filepath: "${base0D}" shape_filepath: "${base0D}"
shape_globpattern: { fg: "${base0D}" attr: b } shape_globpattern: { fg: "${base0D}" attr: b }
shape_variable: "${base0E}" shape_variable: "${base0E}"
shape_flag: { fg: "${base0D}" attr: b } shape_flag: { fg: "${base0D}" attr: b }
shape_custom: { attr: b } shape_custom: { attr: b }
} }
''; '';
} }

View file

@ -1,239 +1,223 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
let let
background = base00; colors = config.lib.stylix.colors.withHashtag;
secondary-background = base01; background = colors.base00;
selection-background = base03; secondary-background = colors.base01;
selection-background = colors.base03;
foreground = base05; foreground = colors.base05;
inverted-foreground = base00; inverted-foreground = colors.base00;
error = base08; error = colors.base08;
info = base0B; info = colors.base0B;
secondary-info = base0C; secondary-info = colors.base0C;
warning = base0E; warning = colors.base0E;
in in
{ {
options.stylix.targets.qutebrowser.enable = options.stylix.targets.qutebrowser.enable =
config.lib.stylix.mkEnableTarget "Qutebrowser" true; config.lib.stylix.mkEnableTarget "Qutebrowser" true;
config = config =
lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) with config.stylix.fonts;
{ lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) {
programs.qutebrowser.settings = { programs.qutebrowser.settings = {
colors = { colors = {
completion = { completion = {
category = { category = {
bg = background; bg = background;
fg = info; fg = info;
border = { border = {
bottom = background; bottom = background;
top = background; top = background;
}; };
};
even.bg = background;
fg = foreground;
item.selected = {
bg = selection-background;
border = {
bottom = selection-background;
top = selection-background;
}; };
even.bg = background;
fg = foreground; fg = foreground;
item.selected = {
bg = selection-background;
border = {
bottom = selection-background;
top = selection-background;
};
fg = foreground;
};
match.fg = info;
odd.bg = secondary-background;
scrollbar = {
bg = background;
fg = foreground;
};
}; };
contextmenu = { match.fg = info;
disabled = { odd.bg = secondary-background;
bg = secondary-background;
fg = inverted-foreground;
};
menu = { scrollbar = {
bg = background; bg = background;
fg = foreground; fg = foreground;
};
selected = {
bg = selection-background;
fg = foreground;
};
}; };
};
downloads = { contextmenu = {
bar.bg = background; disabled = {
error = {
bg = error;
fg = inverted-foreground;
};
start = {
bg = info;
fg = inverted-foreground;
};
stop = {
bg = secondary-info;
fg = inverted-foreground;
};
};
hints = {
bg = secondary-background; bg = secondary-background;
fg = foreground; fg = inverted-foreground;
match.fg = info;
}; };
keyhint = { menu = {
bg = background; bg = background;
fg = foreground; fg = foreground;
suffix.fg = foreground;
}; };
messages = { selected = {
error = { bg = selection-background;
bg = error;
fg = inverted-foreground;
border = error;
};
info = {
bg = info;
fg = inverted-foreground;
border = info;
};
warning = {
bg = warning;
fg = inverted-foreground;
border = warning;
};
};
prompts = {
bg = background;
border = background;
fg = foreground; fg = foreground;
selected.bg = secondary-background; };
};
downloads = {
bar.bg = background;
error = {
bg = error;
fg = inverted-foreground;
}; };
statusbar = { start = {
caret = { bg = info;
fg = inverted-foreground;
};
stop = {
bg = secondary-info;
fg = inverted-foreground;
};
};
hints = {
bg = secondary-background;
fg = foreground;
match.fg = info;
};
keyhint = {
bg = background;
fg = foreground;
suffix.fg = foreground;
};
messages = {
error = {
bg = error;
fg = inverted-foreground;
border = error;
};
info = {
bg = info;
fg = inverted-foreground;
border = info;
};
warning = {
bg = warning;
fg = inverted-foreground;
border = warning;
};
};
prompts = {
bg = background;
border = background;
fg = foreground;
selected.bg = secondary-background;
};
statusbar = {
caret = {
bg = selection-background;
fg = foreground;
selection = {
bg = selection-background; bg = selection-background;
fg = foreground; fg = foreground;
selection = {
bg = selection-background;
fg = foreground;
};
}; };
};
command = { command = {
bg = background; bg = background;
fg = foreground; fg = foreground;
private = {
bg = secondary-background;
fg = foreground;
};
};
insert = {
bg = info;
fg = inverted-foreground;
};
normal = {
bg = background;
fg = foreground;
};
passthrough = {
bg = secondary-info;
fg = inverted-foreground;
};
private = { private = {
bg = secondary-background; bg = secondary-background;
fg = foreground; fg = foreground;
}; };
progress.bg = info;
url = {
error.fg = error;
fg = foreground;
hover.fg = foreground;
success = {
http.fg = secondary-info;
https.fg = info;
};
warn.fg = warning;
};
}; };
tabs = { insert = {
bar.bg = background; bg = info;
fg = inverted-foreground;
};
even = { normal = {
bg = secondary-background; bg = background;
fg = foreground; fg = foreground;
};
passthrough = {
bg = secondary-info;
fg = inverted-foreground;
};
private = {
bg = secondary-background;
fg = foreground;
};
progress.bg = info;
url = {
error.fg = error;
fg = foreground;
hover.fg = foreground;
success = {
http.fg = secondary-info;
https.fg = info;
}; };
indicator = { warn.fg = warning;
inherit error; };
start = secondary-info; };
stop = info;
tabs = {
bar.bg = background;
even = {
bg = secondary-background;
fg = foreground;
};
indicator = {
inherit error;
start = secondary-info;
stop = info;
};
odd = {
bg = background;
fg = foreground;
};
pinned = {
even = {
bg = info;
fg = inverted-foreground;
}; };
odd = { odd = {
bg = background; bg = secondary-info;
fg = foreground; fg = inverted-foreground;
};
pinned = {
even = {
bg = info;
fg = inverted-foreground;
};
odd = {
bg = secondary-info;
fg = inverted-foreground;
};
selected = {
even = {
bg = selection-background;
fg = foreground;
};
odd = {
bg = selection-background;
fg = foreground;
};
};
}; };
selected = { selected = {
@ -249,38 +233,51 @@ in
}; };
}; };
webpage = selected = {
let even = {
isDark = config.stylix.polarity == "dark"; bg = selection-background;
in fg = foreground;
{
darkmode.enabled = lib.mkIf isDark (lib.mkDefault true);
preferred_color_scheme = lib.mkIf isDark (lib.mkDefault config.stylix.polarity);
};
};
fonts = {
default_family = sansSerif.name;
default_size = "${toString sizes.applications}pt";
web = {
family = {
cursive = serif.name;
fantasy = serif.name;
fixed = monospace.name;
sans_serif = sansSerif.name;
serif = serif.name;
standard = sansSerif.name;
}; };
# TODO: Use the pixel unit: odd = {
# https://github.com/danth/stylix/issues/251. bg = selection-background;
size.default = builtins.floor (sizes.applications * 4 / 3 + 0.5); fg = foreground;
};
}; };
}; };
hints.border = background; 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 = {
default_family = sansSerif.name;
default_size = "${toString sizes.applications}pt";
web = {
family = {
cursive = serif.name;
fantasy = serif.name;
fixed = monospace.name;
sans_serif = sansSerif.name;
serif = serif.name;
standard = sansSerif.name;
};
# TODO: Use the pixel unit:
# https://github.com/danth/stylix/issues/251.
size.default = builtins.floor (sizes.applications * 4 / 3 + 0.5);
};
};
hints.border = background;
}; };
};
} }

View file

@ -5,9 +5,6 @@
lib, lib,
... ...
}: }:
let
colors = config.lib.stylix.colors.withHashtag;
in
{ {
options.stylix.targets.rio.enable = config.lib.stylix.mkEnableTarget "Rio" true; options.stylix.targets.rio.enable = config.lib.stylix.mkEnableTarget "Rio" true;
@ -20,7 +17,7 @@ in
size = sizes.terminal * 4.0 / 3.0; size = sizes.terminal * 4.0 / 3.0;
}; };
window.opacity = with config.stylix.opacity; terminal; window.opacity = with config.stylix.opacity; terminal;
colors = with colors; { colors = with config.lib.stylix.colors.withHashtag; {
selection-background = base02; selection-background = base02;
selection-foreground = base05; selection-foreground = base05;
cursor = base05; cursor = base05;

View file

@ -1,7 +1,4 @@
{ config, lib, ... }: { config, lib, ... }:
with config.stylix.fonts;
let let
inherit (config.lib.formats.rasi) mkLiteral; inherit (config.lib.formats.rasi) mkLiteral;
mkRgba = mkRgba =
@ -24,7 +21,7 @@ in
config = lib.mkIf (config.stylix.enable && config.stylix.targets.rofi.enable) { config = lib.mkIf (config.stylix.enable && config.stylix.targets.rofi.enable) {
programs.rofi = { programs.rofi = {
font = "${monospace.name} ${toString sizes.popups}"; font = with config.stylix.fonts; "${monospace.name} ${toString sizes.popups}";
theme = { theme = {
"*" = { "*" = {
background = mkRgba rofiOpacity "base00"; background = mkRgba rofiOpacity "base00";

View file

@ -1,20 +1,11 @@
{ config, lib, ... }: { config, lib, ... }:
with config.lib.stylix.colors.withHashtag;
let let
cfg = config.stylix.targets.sway; cfg = config.stylix.targets.sway;
text = base05;
urgent = base08;
focused = base0D;
unfocused = base03;
fonts = { fonts = {
names = [ config.stylix.fonts.sansSerif.name ]; names = [ config.stylix.fonts.sansSerif.name ];
size = config.stylix.fonts.sizes.desktop + 0.0; size = config.stylix.fonts.sizes.desktop + 0.0;
}; };
in in
{ {
options.stylix.targets.sway = { options.stylix.targets.sway = {
@ -22,89 +13,97 @@ in
useWallpaper = config.lib.stylix.mkEnableWallpaper "Sway" true; useWallpaper = config.lib.stylix.mkEnableWallpaper "Sway" true;
}; };
config = lib.mkMerge [ config =
(lib.mkIf (config.stylix.enable && cfg.enable) { with config.lib.stylix.colors.withHashtag;
wayland.windowManager.sway.config = { let
inherit fonts; text = base05;
urgent = base08;
focused = base0D;
unfocused = base03;
in
lib.mkMerge [
(lib.mkIf (config.stylix.enable && cfg.enable) {
wayland.windowManager.sway.config = {
inherit fonts;
colors = colors =
let let
background = base00; background = base00;
indicator = base0B; indicator = base0B;
in in
{ {
inherit background; inherit background;
urgent = { urgent = {
inherit background indicator text; inherit background indicator text;
border = urgent; border = urgent;
childBorder = urgent; childBorder = urgent;
};
focused = {
inherit background indicator text;
border = focused;
childBorder = focused;
};
focusedInactive = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
unfocused = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
placeholder = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
}; };
focused = {
inherit background indicator text;
border = focused;
childBorder = focused;
};
focusedInactive = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
unfocused = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
placeholder = {
inherit background indicator text;
border = unfocused;
childBorder = unfocused;
};
};
output."*".bg = output."*".bg =
lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}"; lib.mkIf cfg.useWallpaper "${config.stylix.image} ${config.stylix.imageScalingMode}";
seat."*".xcursor_theme = lib.mkIf ( seat."*".xcursor_theme = lib.mkIf (
config.stylix.cursor != null config.stylix.cursor != null
) ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}''; ) ''"${config.stylix.cursor.name}" ${toString config.stylix.cursor.size}'';
}; };
}) })
{ {
# Merge this with your bar configuration using //config.lib.stylix.sway.bar # Merge this with your bar configuration using //config.lib.stylix.sway.bar
lib.stylix.sway.bar = { lib.stylix.sway.bar = {
inherit fonts; inherit fonts;
colors = colors =
let let
background = base01; background = base01;
border = background; border = background;
in in
{ {
inherit background; inherit background;
statusline = text; statusline = text;
separator = base03; separator = base03;
focusedWorkspace = { focusedWorkspace = {
inherit text border; inherit text border;
background = focused; background = focused;
};
activeWorkspace = {
inherit text border;
background = unfocused;
};
inactiveWorkspace = {
inherit text border;
background = unfocused;
};
urgentWorkspace = {
inherit text border;
background = urgent;
};
bindingMode = {
inherit text border;
background = urgent;
};
}; };
activeWorkspace = { };
inherit text border; }
background = unfocused; ];
};
inactiveWorkspace = {
inherit text border;
background = unfocused;
};
urgentWorkspace = {
inherit text border;
background = urgent;
};
bindingMode = {
inherit text border;
background = urgent;
};
};
};
}
];
} }

View file

@ -4,19 +4,8 @@
lib, lib,
... ...
}: }:
with config.lib.stylix.colors;
let let
cfg = config.stylix.targets.swaylock; cfg = config.stylix.targets.swaylock;
inside = base01-hex;
outside = base01-hex;
ring = base05-hex;
text = base05-hex;
positive = base0B-hex;
negative = base08-hex;
in in
{ {
imports = [ imports = [
@ -65,6 +54,15 @@ in
) )
{ {
programs.swaylock.settings = programs.swaylock.settings =
with config.lib.stylix.colors;
let
inside = base01-hex;
outside = base01-hex;
ring = base05-hex;
text = base05-hex;
positive = base0B-hex;
negative = base08-hex;
in
{ {
color = outside; color = outside;
scaling = config.stylix.imageScalingMode; scaling = config.stylix.imageScalingMode;

View file

@ -3,10 +3,6 @@
lib, lib,
... ...
}: }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
{ {
options.stylix.targets.swaync = { options.stylix.targets.swaync = {
enable = config.lib.stylix.mkEnableTarget "SwayNC" true; enable = config.lib.stylix.mkEnableTarget "SwayNC" true;
@ -16,6 +12,8 @@ with config.stylix.fonts;
lib.mkIf (config.stylix.enable && config.stylix.targets.swaync.enable) lib.mkIf (config.stylix.enable && config.stylix.targets.swaync.enable)
{ {
services.swaync.style = services.swaync.style =
with config.stylix.fonts;
with config.lib.stylix.colors.withHashtag;
'' ''
@define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03}; @define-color base00 ${base00}; @define-color base01 ${base01}; @define-color base02 ${base02}; @define-color base03 ${base03};
@define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07}; @define-color base04 ${base04}; @define-color base05 ${base05}; @define-color base06 ${base06}; @define-color base07 ${base07};

View file

@ -3,14 +3,14 @@
lib, lib,
... ...
}: }:
with config.stylix.fonts;
with config.lib.stylix.colors.withHashtag;
{ {
options.stylix.targets.tofi.enable = options.stylix.targets.tofi.enable =
config.lib.stylix.mkEnableTarget "Tofi" true; config.lib.stylix.mkEnableTarget "Tofi" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) { config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) {
programs.tofi.settings = programs.tofi.settings =
with config.stylix.fonts;
with config.lib.stylix.colors.withHashtag;
let let
opacity = lib.toHexString ( opacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100 ((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100

View file

@ -5,8 +5,6 @@
... ...
}@args: }@args:
with config.stylix.fonts;
let let
extension = extension =
pkgs.runCommandLocal "stylix-vscode" pkgs.runCommandLocal "stylix-vscode"

View file

@ -1,13 +1,10 @@
{ config, lib, ... }: { config, lib, ... }:
let
colors = config.lib.stylix.colors.withHashtag;
in
{ {
options.stylix.targets.wezterm.enable = options.stylix.targets.wezterm.enable =
config.lib.stylix.mkEnableTarget "wezterm" true; config.lib.stylix.mkEnableTarget "wezterm" true;
config = config =
with config.lib.stylix.colors.withHashtag;
lib.mkIf lib.mkIf
( (
config.stylix.enable config.stylix.enable
@ -15,8 +12,7 @@ in
&& config.programs.wezterm.enable && config.programs.wezterm.enable
) )
{ {
programs.wezterm.colorSchemes.stylix = {
programs.wezterm.colorSchemes.stylix = with colors; {
ansi = [ ansi = [
base00 base00
base08 base08
@ -74,7 +70,6 @@ in
}; };
xdg.configFile."wezterm/wezterm.lua".text = xdg.configFile."wezterm/wezterm.lua".text =
with colors;
with config.stylix.fonts; with config.stylix.fonts;
lib.mkForce '' lib.mkForce ''
-- Generated by Stylix -- Generated by Stylix

View file

@ -3,45 +3,44 @@
lib, lib,
... ...
}: }:
with config.stylix.fonts;
let
colors = config.lib.stylix.colors.withHashtag;
in
{ {
options.stylix.targets.wofi.enable = options.stylix.targets.wofi.enable =
config.lib.stylix.mkEnableTarget "wofi" config.programs.wofi.enable; config.lib.stylix.mkEnableTarget "wofi" config.programs.wofi.enable;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wofi.enable) { config = lib.mkIf (config.stylix.enable && config.stylix.targets.wofi.enable) {
programs.wofi.style = with colors; '' programs.wofi.style =
window { with config.lib.stylix.colors.withHashtag;
font-family: "${monospace.name}"; with config.stylix.fonts;
font-size: ${toString sizes.popups}pt; ''
window {
font-family: "${monospace.name}";
font-size: ${toString sizes.popups}pt;
background-color: ${base00}; background-color: ${base00};
color: ${base05}; color: ${base05};
} }
#entry:nth-child(odd) { #entry:nth-child(odd) {
background-color: ${base00}; background-color: ${base00};
} }
#entry:nth-child(even) { #entry:nth-child(even) {
background-color: ${base01}; background-color: ${base01};
} }
#entry:selected { #entry:selected {
background-color: ${base02}; background-color: ${base02};
} }
#input { #input {
background-color: ${base01}; background-color: ${base01};
color: ${base04}; color: ${base04};
border-color: ${base02}; border-color: ${base02};
} }
#input:focus { #input:focus {
border-color: ${base0A}; border-color: ${base0A};
} }
''; '';
}; };
} }