treewide: use mkTarget (batch 2) (#1362)

Link: https://github.com/nix-community/stylix/pull/1362

Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-05-23 10:23:39 -07:00 committed by GitHub
parent 8dd18dd395
commit 7ffb31da69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1355 additions and 1238 deletions

View file

@ -1,8 +1,14 @@
{ config, lib, ... }:
{
options.stylix.targets.bemenu = {
enable = config.lib.stylix.mkEnableTarget "bemenu" true;
mkTarget,
lib,
config,
...
}:
mkTarget {
name = "bemenu";
humanName = "bemenu";
extraOptions = {
fontSize = lib.mkOption {
description = ''
Font size used for bemenu.
@ -20,15 +26,26 @@
};
};
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.bemenu.enable)
configElements = [
(
{ cfg, fonts }:
{
programs.bemenu.settings = {
# Font name
fn = "${fonts.sansSerif.name} ${
lib.optionalString (cfg.fontSize != null) (builtins.toString cfg.fontSize)
}";
};
}
)
(
{ colors, opacity }:
{
programs.bemenu.settings =
with config.lib.stylix.colors.withHashtag;
with colors.withHashtag;
let
inherit (config.stylix.targets.bemenu) alternate fontSize;
bemenuOpacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
((builtins.ceil (opacity.popups * 100)) * 255) / 100
);
in
{
@ -48,11 +65,8 @@
ab = "${if alternate then base00 else base01}"; # Alternate bg
af = "${if alternate then base04 else base05}"; # Alternate fg
# Font name
fn = "${config.stylix.fonts.sansSerif.name} ${
lib.optionalString (fontSize != null) (builtins.toString fontSize)
}";
};
};
}
)
];
}

View file

@ -1,40 +1,50 @@
{ config, lib, ... }:
{
options.stylix.targets.dunst.enable =
config.lib.stylix.mkEnableTarget "Dunst" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "dunst";
humanName = "Dunst";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.dunst.enable) {
services.dunst.settings =
with config.lib.stylix.colors.withHashtag;
let
inherit (config.stylix) fonts;
dunstOpacity = lib.toHexString (
((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100
);
in
configElements = [
(
{ fonts }:
{
global = {
separator_color = base02;
font = "${fonts.sansSerif.name} ${toString fonts.sizes.popups}";
};
services.dunst.settings.global.font =
"${fonts.sansSerif.name} ${toString fonts.sizes.popups}";
}
)
(
{ colors, opacity }:
{
services.dunst.settings =
with colors.withHashtag;
let
dunstOpacity = lib.toHexString (
((builtins.floor (opacity.popups * 100 + 0.5)) * 255) / 100
);
in
{
global = {
separator_color = base02;
};
urgency_low = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0B;
};
urgency_low = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0B;
};
urgency_normal = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0E;
};
urgency_normal = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base0E;
};
urgency_critical = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base08;
};
};
};
urgency_critical = {
background = base01 + dunstOpacity;
foreground = base05;
frame_color = base08;
};
};
}
)
];
}

View file

@ -1,40 +1,45 @@
{
config,
lib,
...
}:
{
options.stylix.targets.fcitx5.enable =
config.lib.stylix.mkEnableTarget "fcitx5" true;
{ mkTarget, ... }:
mkTarget {
name = "fcitx5";
humanName = "fcitx5";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.fcitx5.enable)
configElements = [
(
{ fonts }:
{
i18n.inputMethod.fcitx5.settings.addons.classicui.globalSection = with fonts; {
Font = "${sansSerif.name} ${toString sizes.popups}";
MenuFont = "${sansSerif.name} ${toString sizes.popups}";
TrayFont = "${sansSerif.name} ${toString sizes.popups}";
};
}
)
(
{ colors }:
{
i18n.inputMethod.fcitx5 = {
settings.addons.classicui.globalSection = with config.stylix.fonts; {
settings.addons.classicui.globalSection = {
Theme = "stylix";
UseDarkTheme = false;
UseAccentColor = false;
Font = "${sansSerif.name} ${toString sizes.popups}";
MenuFont = "${sansSerif.name} ${toString sizes.popups}";
TrayFont = "${sansSerif.name} ${toString sizes.popups}";
};
themes.stylix = {
# Adapted from https://github.com/sanweiya/fcitx5-mellow-themes under the BSD 2 license (compatible with this project's license (MIT))
# Copyright (c) 2024, sanweiya
highlightImage = config.lib.stylix.colors {
highlightImage = colors {
template = ./highlight.svg.mustache;
extension = ".svg";
};
panelImage = config.lib.stylix.colors {
panelImage = colors {
template = ./panel.svg.mustache;
extension = ".svg";
};
theme = import ./template.nix {
colors = config.lib.stylix.colors.withHashtag;
colors = colors.withHashtag;
};
};
};
};
}
)
];
}

View file

@ -1,36 +1,26 @@
{
mkTarget,
lib,
pkgs,
config,
lib,
...
}:
let
cfg = config.stylix.targets.feh;
in
{
options.stylix.targets.feh = {
enable = config.lib.stylix.mkEnableTarget "the desktop background using Feh" (
config.stylix.image != null
);
};
mkTarget {
name = "feh";
humanName = "the desktop background using Feh";
autoEnable =
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable;
config.xsession.initExtra =
lib.mkIf
(
config.stylix.enable
&& cfg.enable
&& (
with config.xsession.windowManager;
bspwm.enable
|| herbstluftwm.enable
|| i3.enable
|| spectrwm.enable
|| xmonad.enable
)
)
(
configElements =
{ imageScalingMode, image }:
{
xsession.initExtra =
let
inherit (config.stylix) imageScalingMode;
bg-arg =
if imageScalingMode == "fill" then
"--bg-fill"
@ -44,6 +34,6 @@ in
else
"--bg-max";
in
"${lib.getExe pkgs.feh} --no-fehbg ${bg-arg} ${config.stylix.image}"
);
"${lib.getExe pkgs.feh} --no-fehbg ${bg-arg} ${image}";
};
}

View file

@ -1,39 +1,52 @@
{ lib, config, ... }:
{
options.stylix.targets.fnott.enable =
config.lib.stylix.mkEnableTarget "Fnott" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "fnott";
humanName = "Fnott";
config.services.fnott.settings =
lib.mkIf (config.stylix.enable && config.stylix.targets.fnott.enable)
(
let
font = "${config.stylix.fonts.sansSerif.name}:size=${toString config.stylix.fonts.sizes.popups}";
fg = c: "${c}ff";
bg =
c:
"${c}${
lib.toHexString (
((builtins.floor (config.stylix.opacity.popups * 100 + 0.5)) * 255) / 100
)
}";
in
with config.lib.stylix.colors;
{
main = {
title-font = font;
summary-font = font;
body-font = font;
title-color = fg base05;
summary-color = fg base05;
body-color = fg base05;
progress-bar-color = fg base02;
background = bg base00;
configElements = [
(
{ fonts }:
{
services.fnott.settings =
let
font = "${fonts.sansSerif.name}:size=${toString fonts.sizes.popups}";
in
{
main = {
title-font = font;
summary-font = font;
body-font = font;
};
};
}
)
(
{ colors, opacity }:
{
services.fnott.settings =
let
fg = c: "${c}ff";
bg =
c:
"${c}${
lib.toHexString (((builtins.floor (opacity.popups * 100 + 0.5)) * 255) / 100)
}";
in
with colors;
{
main = {
title-color = fg base05;
summary-color = fg base05;
body-color = fg base05;
progress-bar-color = fg base02;
background = bg base00;
};
low.border-color = fg base0B;
normal.border-color = fg base0E;
critical.border-color = fg base08;
}
);
low.border-color = fg base0B;
normal.border-color = fg base0E;
critical.border-color = fg base08;
};
}
)
];
}

View file

@ -1,16 +1,24 @@
{ config, lib, ... }:
let
opacity = lib.toHexString (builtins.ceil (config.stylix.opacity.popups * 255));
in
{
options.stylix.targets.fuzzel.enable =
config.lib.stylix.mkEnableTarget "Fuzzel" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "fuzzel";
humanName = "Fuzzel";
config.programs.fuzzel.settings =
lib.mkIf (config.stylix.enable && config.stylix.targets.fuzzel.enable)
configElements = [
(
{ fonts }:
{
colors = with config.lib.stylix.colors; {
background = "${base00-hex}${opacity}";
programs.fuzzel.settings.main.font =
"${fonts.sansSerif.name}:size=${toString fonts.sizes.popups}";
}
)
(
{ colors, opacity }:
let
opacity' = lib.toHexString (builtins.ceil (opacity.popups * 255));
in
{
programs.fuzzel.settings.colors = with colors; {
background = "${base00-hex}${opacity'}";
text = "${base05-hex}ff";
placeholder = "${base03-hex}ff";
prompt = "${base05-hex}ff";
@ -22,9 +30,7 @@ in
counter = "${base06-hex}ff";
border = "${base0D-hex}ff";
};
main = {
font = "${config.stylix.fonts.sansSerif.name}:size=${toString config.stylix.fonts.sizes.popups}";
};
};
}
)
];
}

View file

@ -1,23 +1,24 @@
{ config, lib, ... }:
{
options.stylix.targets.fzf = {
enable = config.lib.stylix.mkEnableTarget "Fzf" true;
};
{ mkTarget, ... }:
mkTarget {
name = "fzf";
humanName = "Fzf";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fzf.enable) {
programs.fzf.colors = with config.lib.stylix.colors.withHashtag; {
"bg" = base00;
"bg+" = base01;
"fg" = base04;
"fg+" = base06;
"header" = base0D;
"hl" = base0D;
"hl+" = base0D;
"info" = base0A;
"marker" = base0C;
"pointer" = base0C;
"prompt" = base0A;
"spinner" = base0C;
configElements =
{ colors }:
{
programs.fzf.colors = with colors.withHashtag; {
"bg" = base00;
"bg+" = base01;
"fg" = base04;
"fg+" = base06;
"header" = base0D;
"hl" = base0D;
"hl+" = base0D;
"info" = base0A;
"marker" = base0C;
"pointer" = base0C;
"prompt" = base0A;
"spinner" = base0C;
};
};
};
}

View file

@ -1,58 +1,65 @@
# Documentation is available at:
# - https://ghostty.org/docs/config/reference
# - `man 5 ghostty`
{ config, lib, ... }:
{
options.stylix.targets.ghostty.enable =
config.lib.stylix.mkEnableTarget "Ghostty" true;
{ mkTarget, ... }:
mkTarget {
name = "ghostty";
humanName = "Ghostty";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.ghostty.enable)
configElements = [
(
{ fonts }:
{
programs.ghostty.settings = {
font-family = [
fonts.monospace.name
fonts.emoji.name
];
font-size = fonts.sizes.terminal;
};
}
)
(
{ opacity }:
{
programs.ghostty.settings = {
background-opacity = opacity.terminal;
};
}
)
(
{ colors }:
{
programs.ghostty = {
settings =
let
inherit (config.stylix) fonts opacity;
in
{
theme = "stylix";
font-family = [
fonts.monospace.name
fonts.emoji.name
];
font-size = fonts.sizes.terminal;
background-opacity = opacity.terminal;
};
themes.stylix =
let
inherit (config.lib.stylix) colors;
in
{
background = colors.base00;
foreground = colors.base05;
cursor-color = colors.base05;
selection-background = colors.base02;
selection-foreground = colors.base05;
settings.theme = "stylix";
themes.stylix = {
background = colors.base00;
foreground = colors.base05;
cursor-color = colors.base05;
selection-background = colors.base02;
selection-foreground = colors.base05;
palette = with colors.withHashtag; [
"0=${base00}"
"1=${base08}"
"2=${base0B}"
"3=${base0A}"
"4=${base0D}"
"5=${base0E}"
"6=${base0C}"
"7=${base05}"
"8=${base03}"
"9=${base08}"
"10=${base0B}"
"11=${base0A}"
"12=${base0D}"
"13=${base0E}"
"14=${base0C}"
"15=${base07}"
];
};
palette = with colors.withHashtag; [
"0=${base00}"
"1=${base08}"
"2=${base0B}"
"3=${base0A}"
"4=${base0D}"
"5=${base0E}"
"6=${base0C}"
"7=${base05}"
"8=${base03}"
"9=${base08}"
"10=${base0B}"
"11=${base0A}"
"12=${base0D}"
"13=${base0E}"
"14=${base0C}"
"15=${base07}"
];
};
};
};
}
)
];
}

View file

@ -1,21 +1,29 @@
{ config, lib, ... }:
let
rgb-to-hsl = import ./rgb-to-hsl.nix { inherit lib config; };
in
{
options.stylix.targets.glance.enable =
config.lib.stylix.mkEnableTarget "Glance" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "glance";
humanName = "Glance";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.glance.enable)
configElements = [
(
{ polarity }:
{
services.glance.settings.theme.light = polarity == "light";
}
)
(
{ colors }:
let
rgb-to-hsl = import ./rgb-to-hsl.nix { inherit lib colors; };
in
{
services.glance.settings.theme = {
light = config.stylix.polarity == "light";
contrast-multiplier = 1.0;
background-color = rgb-to-hsl "base00";
primary-color = rgb-to-hsl "base05";
positive-color = rgb-to-hsl "base01";
negative-color = rgb-to-hsl "base04";
};
};
}
)
];
}

View file

@ -1,22 +1,29 @@
{ config, lib, ... }:
{ mkTarget, lib, ... }:
mkTarget {
name = "glance";
humanName = "Glance";
let
rgb-to-hsl = import ./rgb-to-hsl.nix { inherit lib config; };
in
{
options.stylix.targets.glance.enable =
config.lib.stylix.mkEnableTarget "Glance" true;
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.glance.enable)
configElements = [
(
{ polarity }:
{
services.glance.settings.theme.light = polarity == "light";
}
)
(
{ colors }:
let
rgb-to-hsl = import ./rgb-to-hsl.nix { inherit lib colors; };
in
{
services.glance.settings.theme = {
light = config.stylix.polarity == "light";
contrast-multiplier = 1.0;
background-color = rgb-to-hsl "base00";
primary-color = rgb-to-hsl "base05";
positive-color = rgb-to-hsl "base01";
negative-color = rgb-to-hsl "base04";
};
};
}
)
];
}

View file

@ -1,9 +1,9 @@
{ lib, config, ... }:
{ lib, colors, ... }:
color:
let
r = ((lib.toInt config.lib.stylix.colors."${color}-rgb-r") * 100.0) / 255;
g = ((lib.toInt config.lib.stylix.colors."${color}-rgb-g") * 100.0) / 255;
b = ((lib.toInt config.lib.stylix.colors."${color}-rgb-b") * 100.0) / 255;
r = ((lib.toInt colors."${color}-rgb-r") * 100.0) / 255;
g = ((lib.toInt colors."${color}-rgb-g") * 100.0) / 255;
b = ((lib.toInt colors."${color}-rgb-b") * 100.0) / 255;
max = lib.max r (lib.max g b);
min = lib.min r (lib.min g b);
delta = max - min;

View file

@ -1,18 +1,14 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.hyprpaper;
in
{
options.stylix.targets.hyprpaper = {
enable = config.lib.stylix.mkEnableTarget "Hyprpaper" (
config.stylix.image != null
);
};
{ mkTarget, ... }:
mkTarget {
name = "hyprpaper";
humanName = "Hyprpaper";
config = lib.mkIf (config.stylix.enable && cfg.enable) {
services.hyprpaper.settings = {
preload = [ "${config.stylix.image}" ];
wallpaper = [ ",${config.stylix.image}" ];
configElements =
{ image }:
{
services.hyprpaper.settings = {
preload = [ "${image}" ];
wallpaper = [ ",${image}" ];
};
};
};
}

View file

@ -1,14 +1,12 @@
{
config,
lib,
...
}:
{
options.stylix.targets.k9s.enable = config.lib.stylix.mkEnableTarget "k9s" true;
{ mkTarget, ... }:
mkTarget {
name = "k9s";
humanName = "k9s";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.k9s.enable) {
programs.k9s.skins.skin = {
k9s = with config.lib.stylix.colors.withHashtag; {
configElements =
{ colors }:
{
programs.k9s.skins.skin.k9s = with colors.withHashtag; {
body = {
fgColor = base05;
bgColor = "default";
@ -130,5 +128,4 @@
};
};
};
};
}

View file

@ -1,16 +1,9 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.kitty;
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.tinted-kitty;
target = if cfg.variant256Colors then "base16-256-deprecated" else "base16";
};
in
{
options.stylix.targets.kitty = {
enable = config.lib.stylix.mkEnableTarget "Kitty" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "kitty";
humanName = "Kitty";
extraOptions = {
variant256Colors = lib.mkOption {
description = ''
Whether to use the [256-color variant](https://github.com/kdrag0n/base16-kitty#256-color-variants)
@ -21,16 +14,39 @@ in
};
};
config = lib.mkIf (config.stylix.enable && cfg.enable) {
programs.kitty = {
font = {
inherit (config.stylix.fonts.monospace) package name;
size = config.stylix.fonts.sizes.terminal;
};
settings.background_opacity = "${builtins.toString config.stylix.opacity.terminal}";
extraConfig = ''
include ${theme}
'';
};
};
configElements = [
(
{ fonts }:
{
programs.kitty.font = {
inherit (fonts.monospace) package name;
size = fonts.sizes.terminal;
};
}
)
(
{ opacity }:
{
programs.kitty.settings.background_opacity = toString opacity.terminal;
}
)
(
{
cfg,
colors,
inputs,
}:
let
theme = colors {
templateRepo = inputs.tinted-kitty;
target = if cfg.variant256Colors then "base16-256-deprecated" else "base16";
};
in
{
programs.kitty.extraConfig = ''
include ${theme}
'';
}
)
];
}

View file

@ -1,24 +1,31 @@
{ config, lib, ... }:
{
options.stylix.targets.kmscon.enable =
config.lib.stylix.mkEnableTarget "the kmscon virtual console" true;
{ mkTarget, ... }:
mkTarget {
name = "kmscon";
humanName = "the kmscon virtual console";
config.services.kmscon =
lib.mkIf (config.stylix.enable && config.stylix.targets.kmscon.enable)
configElements = [
(
{ fonts }:
{
fonts = [ config.stylix.fonts.monospace ];
extraConfig =
services.kmscon = {
fonts = [ fonts.monospace ];
extraConfig = "font-size=${toString fonts.sizes.terminal}";
};
}
)
(
{ colors }:
{
services.kmscon.extraConfig =
let
formatBase =
name:
let
getComponent = comp: config.lib.stylix.colors."${name}-rgb-${comp}";
getComponent = comp: colors."${name}-rgb-${comp}";
in
"${getComponent "r"},${getComponent "g"},${getComponent "b"}";
in
''
font-size=${builtins.toString config.stylix.fonts.sizes.terminal}
palette=custom
palette-black=${formatBase "base00"}
@ -41,5 +48,7 @@
palette-background=${formatBase "base00"}
palette-foreground=${formatBase "base05"}
'';
};
}
)
];
}

View file

@ -1,77 +1,82 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.kubecolor;
in
{
options.stylix.targets.kubecolor.enable =
config.lib.stylix.mkEnableTarget "kubecolor" true;
{ mkTarget, ... }:
mkTarget {
name = "kubecolor";
humanName = "kubecolor";
config = lib.mkIf (config.stylix.enable && cfg.enable) {
programs.kubecolor.settings = {
preset =
if config.stylix.polarity == "either" then "" else "${config.stylix.polarity}";
theme = with config.lib.stylix.colors.withHashtag; {
base = {
info = "fg=${base05-hex}";
primary = "fg=${base0E-hex}";
secondary = "fg=${base0D-hex}";
success = "fg=${base0B-hex}:bold";
warning = "fg=${base0A-hex}:bold";
danger = "fg=${base08-hex}:bold";
muted = "fg=${base04-hex}";
key = "fg=${base07-hex}:bold";
};
default = "fg=${base05-hex}";
data = {
key = "fg=${base07-hex}:bold";
string = "fg=${base05-hex}";
true = "fg=${base0B-hex}:bold";
false = "fg=${base08-hex}:bold";
number = "fg=${base0E-hex}";
null = "fg=${base04-hex}";
quantity = "fg=${base0E-hex}";
duration = "fg=${base09-hex}";
durationfresh = "fg=${base0B-hex}";
ratio = {
zero = "fg=${base04-hex}";
equal = "fg=${base0B-hex}";
unequal = "fg=${base0A-hex}";
configElements = [
(
{ polarity }:
{
programs.kubecolor.settings.preset =
if polarity == "either" then "" else polarity;
}
)
(
{ colors }:
{
programs.kubecolor.settings.theme = with colors.withHashtag; {
base = {
info = "fg=${base05-hex}";
primary = "fg=${base0E-hex}";
secondary = "fg=${base0D-hex}";
success = "fg=${base0B-hex}:bold";
warning = "fg=${base0A-hex}:bold";
danger = "fg=${base08-hex}:bold";
muted = "fg=${base04-hex}";
key = "fg=${base07-hex}:bold";
};
default = "fg=${base05-hex}";
data = {
key = "fg=${base07-hex}:bold";
string = "fg=${base05-hex}";
true = "fg=${base0B-hex}:bold";
false = "fg=${base08-hex}:bold";
number = "fg=${base0E-hex}";
null = "fg=${base04-hex}";
quantity = "fg=${base0E-hex}";
duration = "fg=${base09-hex}";
durationfresh = "fg=${base0B-hex}";
ratio = {
zero = "fg=${base04-hex}";
equal = "fg=${base0B-hex}";
unequal = "fg=${base0A-hex}";
};
};
status = {
success = "fg=${base0B-hex}:bold";
warning = "fg=${base0A-hex}:bold";
error = "fg=${base08-hex}:bold";
};
table = {
header = "fg=${base05-hex}:bold";
columns = "fg=${base05-hex}";
};
stderr = {
default = "fg=${base05-hex}";
error = "fg=${base08-hex}:bold";
};
describe = {
key = "fg=${base07-hex}:bold";
};
apply = {
created = "fg=${base0B-hex}";
configured = "fg=${base0A-hex}";
unchanged = "fg=${base05-hex}";
dryrun = "fg=${base0D-hex}";
fallback = "fg=${base05-hex}";
};
explain = {
key = "fg=${base07-hex}:bold";
required = "fg=${base00-hex}:bold";
};
options = {
flag = "fg=${base07-hex}:bold";
};
version = {
key = "fg=${base07-hex}:bold";
};
};
status = {
success = "fg=${base0B-hex}:bold";
warning = "fg=${base0A-hex}:bold";
error = "fg=${base08-hex}:bold";
};
table = {
header = "fg=${base05-hex}:bold";
columns = "fg=${base05-hex}";
};
stderr = {
default = "fg=${base05-hex}";
error = "fg=${base08-hex}:bold";
};
describe = {
key = "fg=${base07-hex}:bold";
};
apply = {
created = "fg=${base0B-hex}";
configured = "fg=${base0A-hex}";
unchanged = "fg=${base05-hex}";
dryrun = "fg=${base0D-hex}";
fallback = "fg=${base05-hex}";
};
explain = {
key = "fg=${base07-hex}:bold";
required = "fg=${base00-hex}:bold";
};
options = {
flag = "fg=${base07-hex}:bold";
};
version = {
key = "fg=${base07-hex}:bold";
};
};
};
};
}
)
];
}

View file

@ -1,14 +1,21 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.lightdm;
in
{
options.stylix.targets.lightdm = {
enable = config.lib.stylix.mkEnableTarget "LightDM" true;
mkTarget,
config,
lib,
...
}:
mkTarget {
name = "lightdm";
humanName = "LightDM";
extraOptions = {
useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true;
};
config.services.xserver.displayManager.lightdm.background = lib.mkIf (
config.stylix.enable && cfg.enable && cfg.useWallpaper
) config.stylix.image;
configElements =
{ cfg, image }:
{
services.xserver.displayManager.lightdm.background =
lib.mkIf cfg.useWallpaper image;
};
}

View file

@ -1,44 +1,46 @@
{
config,
lib,
options,
...
}:
{
options.stylix.targets.mako.enable =
config.lib.stylix.mkEnableTarget "Mako" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "mako";
humanName = "Mako";
# Referenced https://github.com/stacyharper/base16-mako
config = lib.optionalAttrs (options.services ? mako) (
lib.mkIf (config.stylix.enable && config.stylix.targets.mako.enable) {
services.mako =
let
makoOpacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
);
inherit (config.stylix) fonts;
in
with config.lib.stylix.colors.withHashtag;
{
settings = {
background-color = base00 + makoOpacity;
border-color = base0D;
text-color = base05;
progress-color = "over ${base02}";
font = "${fonts.sansSerif.name} ${toString fonts.sizes.popups}";
configElements = [
(
{ fonts }:
{
services.mako.settings.font = "${fonts.sansSerif.name} ${toString fonts.sizes.popups}";
}
)
(
{ colors, opacity }:
{
services.mako =
let
makoOpacity = lib.toHexString (
((builtins.ceil (opacity.popups * 100)) * 255) / 100
);
in
with colors.withHashtag;
{
settings = {
background-color = base00 + makoOpacity;
border-color = base0D;
text-color = base05;
progress-color = "over ${base02}";
"urgency=low" = {
background-color = "${base00}${makoOpacity}";
border-color = base0D;
text-color = base0A;
};
"urgency=high" = {
background-color = "${base00}${makoOpacity}";
border-color = base0D;
text-color = base08;
"urgency=low" = {
background-color = "${base00}${makoOpacity}";
border-color = base0D;
text-color = base0A;
};
"urgency=high" = {
background-color = "${base00}${makoOpacity}";
border-color = base0D;
text-color = base08;
};
};
};
};
}
);
}
)
];
}

View file

@ -1,41 +1,53 @@
{ config, lib, ... }:
{
options.stylix.targets.mangohud.enable =
config.lib.stylix.mkEnableTarget "mangohud" true;
{ mkTarget, ... }:
mkTarget {
name = "mangohud";
humanName = "mangohud";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.mangohud.enable)
configElements = [
(
{ fonts }:
{
programs.mangohud.settings =
let
inherit (config.stylix) fonts opacity;
in
with config.lib.stylix.colors;
{
font_size = fonts.sizes.applications;
font_size_text = fonts.sizes.applications;
background_alpha = opacity.popups;
alpha = opacity.applications;
text_color = base05;
text_outline_color = base00;
background_color = base00;
gpu_color = base0B;
cpu_color = base0D;
vram_color = base0C;
media_player_color = base05;
engine_color = base0E;
wine_color = base0E;
frametime_color = base0B;
battery_color = base04;
io_color = base0A;
gpu_load_color = "${base0B}, ${base0A}, ${base08}";
cpu_load_color = "${base0B}, ${base0A}, ${base08}";
fps_color = "${base0B}, ${base0A}, ${base08}";
programs.mangohud.settings = {
font_size = fonts.sizes.applications;
font_size_text = fonts.sizes.applications;
# TODO: Use the point unit:
# https://github.com/nix-community/stylix/issues/251.
font_scale = 1.33333;
};
};
# TODO: Use the point unit:
# https://github.com/nix-community/stylix/issues/251.
font_scale = 1.33333;
};
}
)
(
{ opacity }:
{
programs.mangohud.settings = {
background_alpha = opacity.popups;
alpha = opacity.applications;
};
}
)
(
{ colors }:
{
programs.mangohud.settings = with colors; {
text_color = base05;
text_outline_color = base00;
background_color = base00;
gpu_color = base0B;
cpu_color = base0D;
vram_color = base0C;
media_player_color = base05;
engine_color = base0E;
wine_color = base0E;
frametime_color = base0B;
battery_color = base04;
io_color = base0A;
gpu_load_color = "${base0B}, ${base0A}, ${base08}";
cpu_load_color = "${base0B}, ${base0A}, ${base08}";
fps_color = "${base0B}, ${base0A}, ${base08}";
};
}
)
];
}

View file

@ -1,13 +1,9 @@
{
config,
lib,
...
}:
{
options.stylix.targets.micro.enable =
config.lib.stylix.mkEnableTarget "micro" true;
{ mkTarget, ... }:
mkTarget {
name = "micro";
humanName = "micro";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.micro.enable) {
configElements = {
# TODO: Provide a real colorscheme once [1] is resolved.
#
# [1]: https://github.com/nix-community/stylix/issues/249

View file

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

View file

@ -1,257 +1,13 @@
{ config, lib, ... }:
let
colors = config.lib.stylix.colors.withHashtag;
background = colors.base00;
secondary-background = colors.base01;
selection-background = colors.base03;
{ mkTarget, lib, ... }:
mkTarget {
name = "qutebrowser";
humanName = "Qutebrowser";
foreground = colors.base05;
inverted-foreground = colors.base00;
error = colors.base08;
info = colors.base0B;
secondary-info = colors.base0C;
warning = colors.base0E;
in
{
options.stylix.targets.qutebrowser.enable =
config.lib.stylix.mkEnableTarget "Qutebrowser" true;
config =
with config.stylix.fonts;
lib.mkIf (config.stylix.enable && config.stylix.targets.qutebrowser.enable) {
programs.qutebrowser.settings = {
colors = {
completion = {
category = {
bg = background;
fg = info;
border = {
bottom = background;
top = background;
};
};
even.bg = background;
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 = {
disabled = {
bg = secondary-background;
fg = inverted-foreground;
};
menu = {
bg = background;
fg = foreground;
};
selected = {
bg = selection-background;
fg = foreground;
};
};
downloads = {
bar.bg = background;
error = {
bg = error;
fg = inverted-foreground;
};
start = {
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;
fg = foreground;
};
};
command = {
bg = background;
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 = {
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;
};
warn.fg = warning;
};
};
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 = {
bg = secondary-info;
fg = inverted-foreground;
};
selected = {
even = {
bg = selection-background;
fg = foreground;
};
odd = {
bg = selection-background;
fg = foreground;
};
};
};
selected = {
even = {
bg = selection-background;
fg = foreground;
};
odd = {
bg = selection-background;
fg = foreground;
};
};
};
webpage.preferred_color_scheme = lib.mkIf (
config.stylix.polarity == "dark"
) "dark";
};
fonts = {
configElements = [
(
{ fonts }:
{
programs.qutebrowser.settings.fonts = with fonts; {
default_family = sansSerif.name;
default_size = "${toString sizes.applications}pt";
@ -270,8 +26,264 @@ in
size.default = builtins.floor (sizes.applications * 4 / 3 + 0.5);
};
};
}
)
(
{ polarity }:
{
programs.qutebrowser.settings.colors.webpage.preferred_color_scheme = lib.mkIf (
polarity == "dark"
) "dark";
}
)
(
{ colors }:
let
colors' = colors.withHashtag;
background = colors'.base00;
secondary-background = colors'.base01;
selection-background = colors'.base03;
hints.border = background;
};
};
foreground = colors'.base05;
inverted-foreground = colors'.base00;
error = colors'.base08;
info = colors'.base0B;
secondary-info = colors'.base0C;
warning = colors'.base0E;
in
{
programs.qutebrowser.settings = {
hints.border = background;
colors = {
completion = {
category = {
bg = background;
fg = info;
border = {
bottom = background;
top = background;
};
};
even.bg = background;
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 = {
disabled = {
bg = secondary-background;
fg = inverted-foreground;
};
menu = {
bg = background;
fg = foreground;
};
selected = {
bg = selection-background;
fg = foreground;
};
};
downloads = {
bar.bg = background;
error = {
bg = error;
fg = inverted-foreground;
};
start = {
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;
fg = foreground;
};
};
command = {
bg = background;
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 = {
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;
};
warn.fg = warning;
};
};
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 = {
bg = secondary-info;
fg = inverted-foreground;
};
selected = {
even = {
bg = selection-background;
fg = foreground;
};
odd = {
bg = selection-background;
fg = foreground;
};
};
};
selected = {
even = {
bg = selection-background;
fg = foreground;
};
odd = {
bg = selection-background;
fg = foreground;
};
};
};
};
};
}
)
];
}

View file

@ -1,42 +1,36 @@
{
config,
lib,
...
}:
{
options.stylix.targets.spotify-player.enable =
config.lib.stylix.mkEnableTarget "spotify-player" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "spotify-player";
humanName = "spotify-player";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.spotify-player.enable)
{
programs.spotify-player = {
settings.theme = "stylix";
themes = [
{
name = "stylix";
palette = with config.lib.stylix.colors.withHashtag; {
background = base00;
foreground = base05;
black = base00;
red = base08;
green = base0B;
yellow = base0A;
blue = base0D;
magenta = base0E;
cyan = base0C;
white = base05;
bright_black = base03;
bright_red = base08;
bright_green = base0B;
bright_yellow = base0A;
bright_blue = base0D;
bright_magenta = base0E;
bright_cyan = base0C;
bright_white = base07;
};
}
];
configElements =
{ colors }:
{
programs.spotify-player = {
settings.theme = "stylix";
themes = lib.singleton {
name = "stylix";
palette = with colors.withHashtag; {
background = base00;
foreground = base05;
black = base00;
red = base08;
green = base0B;
yellow = base0A;
blue = base0D;
magenta = base0E;
cyan = base0C;
white = base05;
bright_black = base03;
bright_red = base08;
bright_green = base0B;
bright_yellow = base0A;
bright_blue = base0D;
bright_magenta = base0E;
bright_cyan = base0C;
bright_white = base07;
};
};
};
};
}

View file

@ -1,76 +1,72 @@
# Starship configuration documentation: https://starship.rs/config/
{
config,
lib,
...
}:
{
options.stylix.targets.starship.enable =
config.lib.stylix.mkEnableTarget "Starship" true;
{ mkTarget, ... }:
mkTarget {
name = "starship";
humanName = "Starship";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.starship.enable)
{
programs.starship.settings = {
palette = "base16";
palettes.base16 = with config.lib.stylix.colors.withHashtag; {
black = base00;
bright-black = base03;
white = base05;
bright-white = base07;
configElements =
{ colors }:
{
programs.starship.settings = {
palette = "base16";
palettes.base16 = with colors.withHashtag; {
black = base00;
bright-black = base03;
white = base05;
bright-white = base07;
# Starship calls magenta purple.
purple = magenta;
bright-purple = bright-magenta;
# Starship calls magenta purple.
purple = magenta;
bright-purple = bright-magenta;
inherit
# Set Starship's standard normal color names.
red
orange
yellow
green
cyan
blue
magenta
brown
inherit
# Set Starship's standard normal color names.
red
orange
yellow
green
cyan
blue
magenta
brown
# Set Starship's standard bright color names.
bright-red
bright-yellow
bright-green
bright-cyan
bright-blue
bright-magenta
# Set Starship's standard bright color names.
bright-red
bright-yellow
bright-green
bright-cyan
bright-blue
bright-magenta
# Add base16 names to the template for custom usage.
base00
base01
base02
base03
base04
base05
base06
base07
base08
base09
base0A
base0B
base0C
base0D
base0E
base0F
# Add base16 names to the template for custom usage.
base00
base01
base02
base03
base04
base05
base06
base07
base08
base09
base0A
base0B
base0C
base0D
base0E
base0F
# Add base24 names to the template for custom usage.
base10
base11
base12
base13
base14
base15
base16
base17
;
};
# Add base24 names to the template for custom usage.
base10
base11
base12
base13
base14
base15
base16
base17
;
};
};
};
}

View file

@ -1,33 +1,38 @@
{
config,
lib,
...
}:
{
options.stylix.targets.swaync = {
enable = config.lib.stylix.mkEnableTarget "SwayNC" true;
};
{ mkTarget, ... }:
mkTarget {
name = "swaync";
humanName = "SwayNC";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.swaync.enable)
configElements = [
(
{ fonts }:
{
services.swaync.style = ''
* {
font-family: "${fonts.sansSerif.name}";
font-size: ${builtins.toString fonts.sizes.desktop}pt;
}
'';
}
)
(
{ colors }:
{
services.swaync.style =
let
inherit (config.stylix) fonts;
in
with config.lib.stylix.colors.withHashtag;
with colors.withHashtag;
''
@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 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 base08 ${base08}; @define-color base09 ${base09}; @define-color base0A ${base0A}; @define-color base0B ${base0B};
@define-color base0C ${base0C}; @define-color base0D ${base0D}; @define-color base0E ${base0E}; @define-color base0F ${base0F};
* {
font-family: "${fonts.sansSerif.name}";
font-size: ${builtins.toString fonts.sizes.desktop}pt;
}
@define-color base08 ${base08}; @define-color base09 ${base09};
@define-color base0A ${base0A}; @define-color base0B ${base0B};
@define-color base0C ${base0C}; @define-color base0D ${base0D};
@define-color base0E ${base0E}; @define-color base0F ${base0F};
''
+ (builtins.readFile ./base.css);
};
}
)
];
}

View file

@ -1,18 +1,24 @@
{ config, lib, ... }:
{
options.stylix.targets.sxiv.enable =
config.lib.stylix.mkEnableTarget "Sxiv" true;
{ mkTarget, ... }:
mkTarget {
name = "sxiv";
humanName = "Sxiv";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.sxiv.enable) {
xresources.properties =
let
inherit (config.lib.stylix) colors;
inherit (config.stylix) fonts;
in
configElements = [
(
{ fonts }:
{
"Sxiv.foreground" = "#${colors.base01}";
"Sxiv.background" = "#${colors.base04}";
"Sxiv.font" = "${fonts.sansSerif.name}-${toString fonts.sizes.applications}";
};
};
xresources.properties."Sxiv.font" =
"${fonts.sansSerif.name}-${toString fonts.sizes.applications}";
}
)
(
{ colors }:
{
xresources.properties = {
"Sxiv.foreground" = "#${colors.base01}";
"Sxiv.background" = "#${colors.base04}";
};
}
)
];
}

View file

@ -1,19 +1,18 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "tmux";
humanName = "Tmux";
let
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.tinted-tmux;
target = "base16";
};
in
{
options.stylix.targets.tmux.enable =
config.lib.stylix.mkEnableTarget "Tmux" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tmux.enable) {
programs.tmux.extraConfig = ''
source-file ${theme}
'';
};
configElements =
{ colors, inputs }:
{
programs.tmux.extraConfig = ''
source-file ${
colors {
templateRepo = inputs.tinted-tmux;
target = "base16";
}
}
'';
};
}

View file

@ -1,41 +1,48 @@
{
config,
lib,
...
}:
{
options.stylix.targets.tofi.enable =
config.lib.stylix.mkEnableTarget "Tofi" true;
{ mkTarget, ... }:
mkTarget {
name = "tofi";
humanName = "Tofi";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) {
programs.tofi.settings =
with config.lib.stylix.colors.withHashtag;
let
inherit (config.stylix) fonts;
opacity = lib.toHexString (
((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100
);
background = base00 + opacity;
foreground = base05;
darkForeground = base04 + opacity;
selection = base03 + opacity;
in
configElements = [
(
{ fonts }:
{
font = fonts.monospace.name;
font-size = toString fonts.sizes.popups;
background-color = background;
outline-color = darkForeground;
border-color = foreground;
text-color = foreground;
prompt-color = base0A;
prompt-background = background;
placeholder-color = selection;
input-background = background;
default-result-background = background;
selection-color = selection;
selection-background = background;
border-width = lib.mkDefault 4;
outline-width = lib.mkDefault 2;
};
};
programs.tofi.settings = {
font = fonts.monospace.name;
font-size = toString fonts.sizes.popups;
};
}
)
(
{ colors, opacity }:
{
programs.tofi.settings =
with colors.withHashtag;
let
opacity' = lib.toHexString (
((builtins.ceil (opacity.popups * 100)) * 255) / 100
);
background = base00 + opacity';
foreground = base05;
darkForeground = base04 + opacity';
selection = base03 + opacity';
in
{
background-color = background;
outline-color = darkForeground;
border-color = foreground;
text-color = foreground;
prompt-color = base0A;
prompt-background = background;
placeholder-color = selection;
input-background = background;
default-result-background = background;
selection-color = selection;
selection-background = background;
border-width = lib.mkDefault 4;
outline-width = lib.mkDefault 2;
};
}
)
];
}

View file

@ -1,18 +1,20 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "wob";
humanName = "wob";
{
options.stylix.targets.wob.enable = config.lib.stylix.mkEnableTarget "wob" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.wob.enable) {
services.wob.settings = {
"" = with config.lib.stylix.colors; {
border_color = base05;
background_color = base00;
bar_color = base0A;
overflow_bar_color = base08;
overflow_background_color = base00;
overflow_border_color = base05;
configElements =
{ colors }:
{
services.wob.settings = {
"" = with colors; {
border_color = base05;
background_color = base00;
bar_color = base0A;
overflow_bar_color = base08;
overflow_background_color = base00;
overflow_border_color = base05;
};
};
};
};
}

View file

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

View file

@ -1,38 +1,32 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.wpaperd;
in
{
options.stylix.targets.wpaperd = {
enable = config.lib.stylix.mkEnableTarget "wpaperd" (
config.stylix.image != null
{ mkTarget, lib, ... }:
mkTarget {
name = "wpaperd";
humanName = "wpaperd";
configElements =
{ imageScalingMode, image }:
(
let
# wpaperd doesn't have any mode close to the described behavior of center
modeMap = {
"stretch" = "stretch";
# wpaperd's center mode is closest to the described behavior of fill
"fill" = "center";
"fit" = "fit";
"tile" = "tile";
};
modeAttrs =
if builtins.hasAttr imageScalingMode modeMap then
{ mode = modeMap.${imageScalingMode}; }
else
lib.info "stylix: wpaperd: unsupported image scaling mode: ${imageScalingMode}"
{ };
in
{
services.wpaperd.settings.any = {
path = "${image}";
} // modeAttrs;
}
);
};
config = lib.mkIf (config.stylix.enable && cfg.enable) (
let
inherit (config.stylix) imageScalingMode;
# wpaperd doesn't have any mode close to the described behavior of center
modeMap = {
"stretch" = "stretch";
# wpaperd's center mode is closest to the described behavior of fill
"fill" = "center";
"fit" = "fit";
"tile" = "tile";
};
modeAttrs =
if builtins.hasAttr imageScalingMode modeMap then
{ mode = modeMap.${imageScalingMode}; }
else
lib.info "stylix: wpaperd: unsupported image scaling mode: ${imageScalingMode}"
{ };
in
{
services.wpaperd.settings.any = {
path = "${config.stylix.image}";
} // modeAttrs;
}
);
}

View file

@ -1,147 +1,144 @@
# Based on the official catppuccin themes https://github.com/yazi-rs/themes
{
config,
lib,
...
}:
{
options.stylix.targets.yazi = {
enable = config.lib.stylix.mkEnableTarget "Yazi" true;
};
{ mkTarget, ... }:
mkTarget {
name = "yazi";
humanName = "Yazi";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.yazi.enable) {
programs.yazi.theme =
with config.lib.stylix.colors.withHashtag;
let
mkFg = fg: { inherit fg; };
mkBg = bg: { inherit bg; };
mkBoth = fg: bg: { inherit fg bg; };
mkSame = c: (mkBoth c c);
in
{
manager = rec {
# Reusing bat themes, since it's suggested in the stying guide
# https://yazi-rs.github.io/docs/configuration/theme#manager
syntect_theme = config.lib.stylix.colors {
template = ../bat/base16-stylix.tmTheme.mustache;
extension = ".tmTheme";
configElements =
{ colors }:
{
programs.yazi.theme =
with colors.withHashtag;
let
mkFg = fg: { inherit fg; };
mkBg = bg: { inherit bg; };
mkBoth = fg: bg: { inherit fg bg; };
mkSame = c: (mkBoth c c);
in
{
manager = rec {
# Reusing bat themes, since it's suggested in the stying guide
# https://yazi-rs.github.io/docs/configuration/theme#manager
syntect_theme = colors {
template = ../bat/base16-stylix.tmTheme.mustache;
extension = ".tmTheme";
};
cwd = mkFg cyan;
hovered = (mkBg base02) // {
bold = true;
};
preview_hovered = hovered;
find_keyword = (mkFg green) // {
bold = true;
};
find_position = mkFg magenta;
marker_selected = mkSame yellow;
marker_copied = mkSame green;
marker_cut = mkSame red;
tab_active = mkBoth base00 blue;
tab_inactive = mkBoth base05 base01;
border_style = mkFg base04;
count_copied = mkBoth base00 green;
count_cut = mkBoth base00 red;
count_selected = mkBoth base00 yellow;
};
cwd = mkFg cyan;
hovered = (mkBg base02) // {
bold = true;
mode = {
normal_main = (mkBoth base00 blue) // {
bold = true;
};
normal_alt = mkBoth blue base00;
select_main = (mkBoth base00 green) // {
bold = true;
};
select_alt = mkBoth green base00;
unset_main = (mkBoth base00 brown) // {
bold = true;
};
unset_alt = mkBoth brown base00;
};
preview_hovered = hovered;
find_keyword = (mkFg green) // {
bold = true;
status = {
progress_label = mkBoth base05 base00;
progress_normal = mkBoth base05 base00;
progress_error = mkBoth red base00;
perm_type = mkFg blue;
perm_read = mkFg yellow;
perm_write = mkFg red;
perm_exec = mkFg green;
perm_sep = mkFg cyan;
};
find_position = mkFg magenta;
marker_selected = mkSame yellow;
marker_copied = mkSame green;
marker_cut = mkSame red;
tab_active = mkBoth base00 blue;
tab_inactive = mkBoth base05 base01;
border_style = mkFg base04;
count_copied = mkBoth base00 green;
count_cut = mkBoth base00 red;
count_selected = mkBoth base00 yellow;
};
mode = {
normal_main = (mkBoth base00 blue) // {
bold = true;
pick = {
border = mkFg blue;
active = mkFg magenta;
inactive = mkFg base05;
};
normal_alt = mkBoth blue base00;
select_main = (mkBoth base00 green) // {
bold = true;
input = {
border = mkFg blue;
title = mkFg base05;
value = mkFg base05;
selected = mkBg base03;
};
select_alt = mkBoth green base00;
unset_main = (mkBoth base00 brown) // {
bold = true;
completion = {
border = mkFg blue;
active = mkBoth magenta base03;
inactive = mkFg base05;
};
unset_alt = mkBoth brown base00;
tasks = {
border = mkFg blue;
title = mkFg base05;
hovered = mkBoth base05 base03;
};
which = {
mask = mkBg base02;
cand = mkFg cyan;
rest = mkFg brown;
desc = mkFg base05;
separator_style = mkFg base04;
};
help = {
on = mkFg magenta;
run = mkFg cyan;
desc = mkFg base05;
hovered = mkBoth base05 base03;
footer = mkFg base05;
};
# https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml
filetype.rules =
let
mkRule = mime: fg: { inherit mime fg; };
in
[
(mkRule "image/*" cyan)
(mkRule "video/*" yellow)
(mkRule "audio/*" yellow)
(mkRule "application/zip" magenta)
(mkRule "application/gzip" magenta)
(mkRule "application/tar" magenta)
(mkRule "application/bzip" magenta)
(mkRule "application/bzip2" magenta)
(mkRule "application/7z-compressed" magenta)
(mkRule "application/rar" magenta)
(mkRule "application/xz" magenta)
(mkRule "application/doc" green)
(mkRule "application/pdf" green)
(mkRule "application/rtf" green)
(mkRule "application/vnd.*" green)
((mkRule "inode/directory" blue) // { bold = true; })
(mkRule "*" base05)
];
};
status = {
progress_label = mkBoth base05 base00;
progress_normal = mkBoth base05 base00;
progress_error = mkBoth red base00;
perm_type = mkFg blue;
perm_read = mkFg yellow;
perm_write = mkFg red;
perm_exec = mkFg green;
perm_sep = mkFg cyan;
};
pick = {
border = mkFg blue;
active = mkFg magenta;
inactive = mkFg base05;
};
input = {
border = mkFg blue;
title = mkFg base05;
value = mkFg base05;
selected = mkBg base03;
};
completion = {
border = mkFg blue;
active = mkBoth magenta base03;
inactive = mkFg base05;
};
tasks = {
border = mkFg blue;
title = mkFg base05;
hovered = mkBoth base05 base03;
};
which = {
mask = mkBg base02;
cand = mkFg cyan;
rest = mkFg brown;
desc = mkFg base05;
separator_style = mkFg base04;
};
help = {
on = mkFg magenta;
run = mkFg cyan;
desc = mkFg base05;
hovered = mkBoth base05 base03;
footer = mkFg base05;
};
# https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/theme.toml
filetype.rules =
let
mkRule = mime: fg: { inherit mime fg; };
in
[
(mkRule "image/*" cyan)
(mkRule "video/*" yellow)
(mkRule "audio/*" yellow)
(mkRule "application/zip" magenta)
(mkRule "application/gzip" magenta)
(mkRule "application/tar" magenta)
(mkRule "application/bzip" magenta)
(mkRule "application/bzip2" magenta)
(mkRule "application/7z-compressed" magenta)
(mkRule "application/rar" magenta)
(mkRule "application/xz" magenta)
(mkRule "application/doc" green)
(mkRule "application/pdf" green)
(mkRule "application/rtf" green)
(mkRule "application/vnd.*" green)
((mkRule "inode/directory" blue) // { bold = true; })
(mkRule "*" base05)
];
};
};
};
}

View file

@ -1,47 +1,45 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "zathura";
humanName = "Zathura";
{
options.stylix.targets.zathura.enable =
config.lib.stylix.mkEnableTarget "Zathura" true;
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.zathura.enable)
{
programs.zathura.options =
let
highlightTransparency = 0.5;
getColorCh =
colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}";
rgb =
color:
''rgb(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"})'';
rgba =
color: alpha:
''rgba(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"}, ${builtins.toString alpha})'';
in
{
# Taken from here:
# https://github.com/doenerkebap/base16-zathura
default-bg = rgba "base00" config.stylix.opacity.applications;
default-fg = rgb "base01";
statusbar-fg = rgb "base04";
statusbar-bg = rgb "base02";
inputbar-bg = rgb "base00";
inputbar-fg = rgb "base07";
notification-bg = rgb "base00";
notification-fg = rgb "base07";
notification-error-bg = rgb "base00";
notification-error-fg = rgb "base08";
notification-warning-bg = rgb "base00";
notification-warning-fg = rgb "base08";
highlight-color = rgba "base0A" highlightTransparency;
highlight-active-color = rgba "base0D" highlightTransparency;
completion-bg = rgb "base01";
completion-fg = rgb "base0D";
completion-highlight-fg = rgb "base07";
completion-highlight-bg = rgb "base0D";
recolor-lightcolor = rgb "base00";
recolor-darkcolor = rgb "base06";
};
};
configElements =
{ colors, opacity }:
{
programs.zathura.options =
let
highlightTransparency = 0.5;
getColorCh = colorName: channel: colors."${colorName}-rgb-${channel}";
rgb =
color:
''rgb(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"})'';
rgba =
color: alpha:
''rgba(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"}, ${builtins.toString alpha})'';
in
{
# Taken from here:
# https://github.com/doenerkebap/base16-zathura
default-bg = rgba "base00" opacity.applications;
default-fg = rgb "base01";
statusbar-fg = rgb "base04";
statusbar-bg = rgb "base02";
inputbar-bg = rgb "base00";
inputbar-fg = rgb "base07";
notification-bg = rgb "base00";
notification-fg = rgb "base07";
notification-error-bg = rgb "base00";
notification-error-fg = rgb "base08";
notification-warning-bg = rgb "base00";
notification-warning-fg = rgb "base08";
highlight-color = rgba "base0A" highlightTransparency;
highlight-active-color = rgba "base0D" highlightTransparency;
completion-bg = rgb "base01";
completion-fg = rgb "base0D";
completion-highlight-fg = rgb "base07";
completion-highlight-bg = rgb "base0D";
recolor-lightcolor = rgb "base00";
recolor-darkcolor = rgb "base06";
};
};
}