treewide: use mkTarget (batch 1) (#1342)

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

Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: Daniel Thwaites <danth@danth.me>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
NAHO 2025-05-22 20:11:59 +02:00 committed by GitHub
commit af4f2b5646
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 482 additions and 450 deletions

View file

@ -1,22 +1,18 @@
{
config,
lib,
options,
...
}:
{
options.stylix.targets.avizo.enable =
config.lib.stylix.mkEnableTarget "Avizo" true;
{ mkTarget, ... }:
mkTarget {
name = "avizo";
humanName = "Avizo";
# Referenced https://github.com/stacyharper/base16-mako
config = lib.optionalAttrs (options.services ? avizo) (
lib.mkIf (config.stylix.enable && config.stylix.targets.avizo.enable) {
configElements =
{ colors, opacity }:
{
services.avizo = {
settings = {
default =
with config.lib.stylix.colors;
with colors;
let
aviOpacity = toString config.stylix.opacity.popups;
aviOpacity = toString opacity.popups;
in
{
background = "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, ${aviOpacity})";
@ -27,6 +23,5 @@
};
};
};
}
);
};
}

View file

@ -1,18 +1,20 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "bat";
humanName = "Bat";
{
options.stylix.targets.bat.enable = config.lib.stylix.mkEnableTarget "Bat" true;
configElements =
{ colors }:
{
programs.bat = {
# This theme is reused for yazi. Changes to the template
# will need to be applied to modules/yazi/hm.nix
themes."base16-stylix".src = colors {
template = ./base16-stylix.tmTheme.mustache;
extension = ".tmTheme";
};
config = lib.mkIf (config.stylix.enable && config.stylix.targets.bat.enable) {
programs.bat = {
# This theme is reused for yazi. Changes to the template
# will need to be applied to modules/yazi/hm.nix
themes."base16-stylix".src = config.lib.stylix.colors {
template = ./base16-stylix.tmTheme.mustache;
extension = ".tmTheme";
config.theme = "base16-stylix";
};
config.theme = "base16-stylix";
};
};
}

View file

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

View file

@ -1,22 +1,27 @@
{ config, lib, ... }:
{
options.stylix.targets.btop.enable =
config.lib.stylix.mkEnableTarget "btop" true;
mkTarget,
lib,
...
}:
mkTarget {
name = "btop";
humanName = "btop";
config =
lib.mkIf
(
config.stylix.enable
&& config.stylix.targets.btop.enable
&& config.programs.btop.enable
)
configElements = [
(
{ opacity }:
{
programs.btop.settings.theme_background = lib.mkIf (
opacity.terminal != 1.0
) false;
}
)
(
{ colors }:
{
programs.btop = {
settings = {
color_theme = "stylix";
theme_background = lib.mkIf (config.stylix.opacity.terminal != 1.0) false;
};
themes.stylix = with config.lib.stylix.colors.withHashtag; ''
settings.color_theme = "stylix";
themes.stylix = with colors.withHashtag; ''
#Generated by Stylix
theme[main_bg]="${base00}"
theme[main_fg]="${base05}"
@ -62,5 +67,7 @@
theme[process_end]="${base08}"
'';
};
};
}
)
];
}

View file

@ -1,14 +1,15 @@
{ config, lib, ... }:
{
options.stylix.targets.cava = {
enable = config.lib.stylix.mkEnableTarget "CAVA" true;
{ mkTarget, lib, ... }:
mkTarget {
name = "cava";
humanName = "CAVA";
extraOptions = {
rainbow.enable = lib.mkEnableOption "rainbow gradient theming";
};
config =
configElements =
{ cfg, colors }:
let
cfg = config.stylix.targets.cava;
mkGradient =
colors:
lib.listToAttrs (
@ -21,10 +22,10 @@
gradient_count = builtins.length colors;
};
in
lib.mkIf (config.stylix.enable && cfg.enable) {
{
programs.cava.settings.color = lib.mkIf cfg.rainbow.enable (
mkGradient (
with config.lib.stylix.colors;
with colors;
[
base0E
base0D

View file

@ -1,23 +1,18 @@
{ config, lib, ... }:
{ mkTarget, lib, ... }:
mkTarget {
name = "cavalier";
humanName = "Cavalier";
{
options.stylix.targets.cavalier.enable =
config.lib.stylix.mkEnableTarget "Cavalier" true;
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.cavalier.enable)
{
programs.cavalier.settings.general = {
ColorProfiles =
let
inherit (config.lib.stylix) colors;
in
lib.singleton {
Name = "Stylix";
FgColors = [ colors.base05 ];
BgColors = [ colors.base00 ];
};
ActiveProfile = 0;
configElements =
{ colors }:
{
programs.cavalier.settings.general = {
ColorProfiles = lib.singleton {
Name = "Stylix";
FgColors = [ colors.base05 ];
BgColors = [ colors.base00 ];
};
ActiveProfile = 0;
};
};
}

View file

@ -1,16 +1,17 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "chromium";
humanName = "Chromium, Google Chrome and Brave";
{
options.stylix.targets.chromium.enable =
config.lib.stylix.mkEnableTarget "Chromium, Google Chrome and Brave" true;
config.programs.chromium =
lib.mkIf (config.stylix.enable && config.stylix.targets.chromium.enable)
{
configElements =
{ colors }:
{
programs.chromium = {
# This enables policies without installing the browser. Policies take up a
# negligible amount of space, so it's reasonable to have this always on.
enable = true;
extraOpts.BrowserThemeColor = config.lib.stylix.colors.withHashtag.base00;
extraOpts.BrowserThemeColor = colors.withHashtag.base00;
};
};
}

View file

@ -1,36 +1,35 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "console";
humanName = "the Nix-on-Droid console";
{
options.stylix.targets.console.enable =
config.lib.stylix.mkEnableTarget "the Nix-on-Droid console" true;
configElements =
{ colors }:
{
terminal.colors = with colors.withHashtag; rec {
background = base00;
foreground = base05;
cursor = base05;
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable)
{
terminal.colors = with config.lib.stylix.colors.withHashtag; rec {
background = base00;
foreground = base05;
cursor = base05;
# normal
color0 = base00;
color1 = base08;
color2 = base0B;
color3 = base0A;
color4 = base0D;
color5 = base0E;
color6 = base0C;
color7 = base05;
# normal
color0 = base00;
color1 = base08;
color2 = base0B;
color3 = base0A;
color4 = base0D;
color5 = base0E;
color6 = base0C;
color7 = base05;
# bright
color8 = base02;
color9 = color1;
color10 = color2;
color11 = color3;
color12 = color4;
color13 = color5;
color14 = color6;
color15 = base07;
};
# bright
color8 = base02;
color9 = color1;
color10 = color2;
color11 = color3;
color12 = color4;
color13 = color5;
color14 = color6;
color15 = base07;
};
};
}

View file

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

View file

@ -1,10 +1,13 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "fish";
humanName = "Fish";
{
options.stylix.targets.fish.enable =
config.lib.stylix.mkEnableTarget "Fish" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
programs.fish.interactiveShellInit = import ./prompt.nix config;
};
configElements =
{ colors, inputs }:
{
programs.fish.interactiveShellInit = import ./prompt.nix {
inherit colors inputs;
};
};
}

View file

@ -1,10 +1,11 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "fish";
humanName = "Fish";
{
options.stylix.targets.fish.enable =
config.lib.stylix.mkEnableTarget "Fish" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
programs.fish.promptInit = import ./prompt.nix config;
};
configElements =
{ colors, inputs }:
{
programs.fish.promptInit = import ./prompt.nix { inherit colors inputs; };
};
}

View file

@ -1,15 +1,12 @@
config:
{ colors, inputs }:
let
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.base16-fish;
};
theme = colors { templateRepo = inputs.base16-fish; };
in
''
source ${theme}
# See https://github.com/tomyun/base16-fish/issues/7 for why this condition exists
if status --is-interactive && test -z "$TMUX"
base16-${config.lib.stylix.colors.slug}
base16-${colors.slug}
end
''

View file

@ -1,30 +1,29 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "foliate";
humanName = "Foliate";
{
options.stylix.targets.foliate.enable =
config.lib.stylix.mkEnableTarget "Foliate" true;
configElements =
{ colors }:
{
programs.foliate = {
settings."viewer/view" = {
theme = "stylix.json";
};
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.foliate.enable)
{
programs.foliate = {
settings."viewer/view" = {
theme = "stylix.json";
themes.stylix = with colors.withHashtag; {
label = "Stylix";
light = {
fg = base00;
bg = base05;
link = base0D;
};
themes.stylix = with config.lib.stylix.colors.withHashtag; {
label = "Stylix";
light = {
fg = base00;
bg = base05;
link = base0D;
};
dark = {
fg = base05;
bg = base00;
link = base0D;
};
dark = {
fg = base05;
bg = base00;
link = base0D;
};
};
};
};
}

View file

@ -1,20 +1,31 @@
{ config, lib, ... }:
{
options.stylix.targets.foot.enable =
config.lib.stylix.mkEnableTarget "Foot" true;
{ mkTarget, ... }:
mkTarget {
name = "foot";
humanName = "Foot";
config.programs.foot.settings = lib.mkIf config.stylix.targets.foot.enable {
main = {
include = toString (
config.lib.stylix.colors {
templateRepo = config.stylix.inputs.tinted-foot;
}
);
font =
with config.stylix.fonts;
"${monospace.name}:size=${toString sizes.terminal}";
dpi-aware = "no";
};
colors.alpha = config.stylix.opacity.terminal;
};
configElements = [
(
{ fonts }:
{
programs.foot.settings.main = {
font = "${fonts.monospace.name}:=size=${toString fonts.sizes.terminal}";
dpi-aware = "no";
};
}
)
(
{ opacity }:
{
programs.foot.settings.colors.alpha = opacity.terminal;
}
)
(
{ colors, inputs }:
{
programs.foot.settings.main.include = toString (colors {
templateRepo = inputs.tinted-foot;
});
}
)
];
}

View file

@ -1,15 +1,14 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "forge";
humanName = "Forge";
{
options.stylix.targets.forge.enable =
config.lib.stylix.mkEnableTarget "Forge" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.forge.enable) {
xdg.configFile."forge/stylesheet/forge/stylesheet.css".source =
config.lib.stylix.colors
{
template = ./stylesheet.css.mustache;
extension = ".css";
};
};
configElements =
{ colors }:
{
xdg.configFile."forge/stylesheet/forge/stylesheet.css".source = colors {
template = ./stylesheet.css.mustache;
extension = ".css";
};
};
}

View file

@ -1,19 +1,16 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "gedit";
humanName = "GEdit";
let
style = config.lib.stylix.colors {
template = ./template.xml.mustache;
extension = ".xml";
};
in
{
options.stylix.targets.gedit.enable =
config.lib.stylix.mkEnableTarget "GEdit" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gedit.enable) {
xdg.dataFile = {
"gedit/styles/stylix.xml".source = style;
configElements =
{ colors }:
{
xdg.dataFile = {
"gedit/styles/stylix.xml".source = colors {
template = ./template.xml.mustache;
extension = ".xml";
};
};
};
};
}

View file

@ -1,33 +1,35 @@
{ config, lib, ... }:
{
options.stylix.targets.gitui.enable =
config.lib.stylix.mkEnableTarget "GitUI" true;
{ mkTarget, ... }:
mkTarget {
name = "gitui";
humanName = "GitUI";
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gitui.enable) {
programs.gitui.theme = with config.lib.stylix.colors.withHashtag; ''
(
selected_tab: Some("Reset"),
command_fg: Some("${base05}"),
selection_bg: Some("${base04}"),
selection_fg: Some("${base05}"),
cmdbar_bg: Some("${base01}"),
cmdbar_extra_lines_bg: Some("${base01}"),
disabled_fg: Some("${base04}"),
diff_line_add: Some("${base0B}"),
diff_line_delete: Some("${base08}"),
diff_file_added: Some("${base0A}"),
diff_file_removed: Some("${base08}"),
diff_file_moved: Some("${base0E}"),
diff_file_modified: Some("${base09}"),
commit_hash: Some("${base07}"),
commit_time: Some("${base05}"),
commit_author: Some("${base0D}"),
danger_fg: Some("${base08}"),
push_gauge_bg: Some("${base0D}"),
push_gauge_fg: Some("${base00}"),
tag_fg: Some("${base06}"),
branch_fg: Some("${base0C}")
)
'';
};
configElements =
{ colors }:
{
programs.gitui.theme = with colors.withHashtag; ''
(
selected_tab: Some("Reset"),
command_fg: Some("${base05}"),
selection_bg: Some("${base04}"),
selection_fg: Some("${base05}"),
cmdbar_bg: Some("${base01}"),
cmdbar_extra_lines_bg: Some("${base01}"),
disabled_fg: Some("${base04}"),
diff_line_add: Some("${base0B}"),
diff_line_delete: Some("${base08}"),
diff_file_added: Some("${base0A}"),
diff_file_removed: Some("${base08}"),
diff_file_moved: Some("${base0E}"),
diff_file_modified: Some("${base09}"),
commit_hash: Some("${base07}"),
commit_time: Some("${base05}"),
commit_author: Some("${base0D}"),
danger_fg: Some("${base08}"),
push_gauge_bg: Some("${base0D}"),
push_gauge_fg: Some("${base00}"),
tag_fg: Some("${base06}"),
branch_fg: Some("${base0C}")
)
'';
};
}

View file

@ -1,13 +1,14 @@
{ config, lib, ... }:
{
options.stylix.targets.halloy.enable =
config.lib.stylix.mkEnableTarget "Halloy" true;
{ mkTarget, ... }:
mkTarget {
name = "halloy";
humanName = "Halloy";
config.programs.halloy =
lib.mkIf (config.stylix.enable && config.stylix.targets.halloy.enable)
{
configElements =
{ colors }:
{
programs.halloy = {
settings.theme = "stylix";
themes.stylix = with config.lib.stylix.colors.withHashtag; {
themes.stylix = with colors.withHashtag; {
general = {
background = base00;
border = base07;
@ -58,4 +59,5 @@
};
};
};
};
}

View file

@ -1,28 +1,39 @@
{
mkTarget,
pkgs,
config,
lib,
...
}:
{
options.stylix.targets.helix.enable =
config.lib.stylix.mkEnableTarget "Helix" true;
mkTarget {
name = "helix";
humanName = "Helix";
config =
lib.mkIf
(
config.stylix.enable
&& config.stylix.targets.helix.enable
&& config.programs.helix.enable
)
extraOptions.transparent = lib.mkEnableOption "transparent theming" // {
internal = true;
default = false;
};
configElements = [
(
{ opacity }:
{
stylix.targets.helix.transparent = opacity.terminal != 1.0;
}
)
(
{
cfg,
colors,
inputs,
}:
{
programs.helix = {
settings.theme = "stylix";
themes.stylix =
let
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.base16-helix;
theme = colors {
templateRepo = inputs.base16-helix;
};
# Removing the background exposes transparency from the terminal. The
@ -32,7 +43,9 @@
sed 's/,\? bg = "base00"//g' <${theme} >$out
'';
in
if config.stylix.opacity.terminal == 1.0 then theme else transparentTheme;
if cfg.transparent then transparentTheme else theme;
};
};
}
)
];
}

View file

@ -1,26 +1,40 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.hyprlock;
in
{
options.stylix.targets.hyprlock = with config.lib.stylix; {
enable = mkEnableTarget "Hyprlock" true;
useWallpaper = mkEnableWallpaper "Hyprlock" true;
mkTarget,
config,
lib,
...
}:
mkTarget {
name = "hyprlock";
humanName = "Hyprlock";
extraOptions = {
useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprlock" true;
};
config = lib.mkIf (config.stylix.enable && cfg.enable) {
programs.hyprlock.settings = with config.lib.stylix.colors; {
background = {
color = "rgb(${base00})";
path = lib.mkIf cfg.useWallpaper "${config.stylix.image}";
};
input-field = {
outer_color = "rgb(${base03})";
inner_color = "rgb(${base00})";
font_color = "rgb(${base05})";
fail_color = "rgb(${base08})";
check_color = "rgb(${base0A})";
};
};
};
configElements = [
(
{ cfg, image }:
{
programs.hyprlock.settings.path = lib.mkIf cfg.useWallpaper "${image}";
}
)
(
{ colors }:
{
programs.hyprlock.settings = with colors; {
background = {
color = "rgb(${base00})";
};
input-field = {
outer_color = "rgb(${base03})";
inner_color = "rgb(${base00})";
font_color = "rgb(${base05})";
fail_color = "rgb(${base08})";
check_color = "rgb(${base0A})";
};
};
}
)
];
}

View file

@ -1,32 +1,27 @@
{
config,
lib,
...
}:
{
options.stylix.targets.lazygit.enable =
config.lib.stylix.mkEnableTarget "lazygit" true;
{ mkTarget, ... }:
mkTarget {
name = "lazygit";
humanName = "lazygit";
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.lazygit.enable)
{
programs.lazygit.settings.gui.theme =
with config.lib.stylix.colors.withHashtag; {
activeBorderColor = [
base07
"bold"
];
inactiveBorderColor = [ base04 ];
searchingActiveBorderColor = [
base02
"bold"
];
optionsTextColor = [ base06 ];
selectedLineBgColor = [ base03 ];
cherryPickedCommitBgColor = [ base02 ];
cherryPickedCommitFgColor = [ base03 ];
unstagedChangesColor = [ base08 ];
defaultFgColor = [ base05 ];
};
configElements =
{ colors }:
{
programs.lazygit.settings.gui.theme = with colors.withHashtag; {
activeBorderColor = [
base07
"bold"
];
inactiveBorderColor = [ base04 ];
searchingActiveBorderColor = [
base02
"bold"
];
optionsTextColor = [ base06 ];
selectedLineBgColor = [ base03 ];
cherryPickedCommitBgColor = [ base02 ];
cherryPickedCommitFgColor = [ base03 ];
unstagedChangesColor = [ base08 ];
defaultFgColor = [ base05 ];
};
};
}

View file

@ -1,19 +1,21 @@
{ config, lib, ... }:
{
{ mkTarget, ... }:
mkTarget {
name = "xfce";
humanName = "Xfce";
# Disabled by default due to https://github.com/nix-community/stylix/issues/180
options.stylix.targets.xfce.enable =
config.lib.stylix.mkEnableTarget "Xfce" false;
autoEnable = false;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.xfce.enable) {
xfconf.settings = with config.stylix.fonts; {
xfwm4 = {
"general/title_font" = "${sansSerif.name} ${toString sizes.desktop}";
};
xsettings = {
"Gtk/FontName" = "${sansSerif.name} ${toString sizes.applications}";
"Gtk/MonospaceFontName" = "${monospace.name} ${toString sizes.applications}";
configElements =
{ fonts }:
{
xfconf.settings = with fonts; {
xfwm4 = {
"general/title_font" = "${sansSerif.name} ${toString sizes.desktop}";
};
xsettings = {
"Gtk/FontName" = "${sansSerif.name} ${toString sizes.applications}";
"Gtk/MonospaceFontName" = "${monospace.name} ${toString sizes.applications}";
};
};
};
};
}

View file

@ -1,40 +1,44 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "xresources";
humanName = "Xresources";
{
options.stylix.targets.xresources.enable =
config.lib.stylix.mkEnableTarget "Xresources" true;
config =
lib.mkIf (config.stylix.enable && config.stylix.targets.xresources.enable)
configElements = [
(
{ fonts }:
{
xresources.properties =
let
inherit (config.stylix) fonts;
in
with config.lib.stylix.colors.withHashtag;
{
"*.faceName" = fonts.monospace.name;
"*.faceSize" = toString fonts.sizes.terminal;
"*.renderFont" = true;
"*foreground" = base05;
"*background" = base00;
"*cursorColor" = base05;
"*color0" = base00;
"*color1" = base08;
"*color2" = base0B;
"*color3" = base0A;
"*color4" = base0D;
"*color5" = base0E;
"*color6" = base0C;
"*color7" = base05;
"*color8" = base03;
"*color9" = base09;
"*color10" = base01;
"*color11" = base02;
"*color12" = base04;
"*color13" = base06;
"*color14" = base0F;
"*color15" = base07;
};
};
xresources.properties = {
"*.faceName" = fonts.monospace.name;
"*.faceSize" = toString fonts.sizes.terminal;
"*.renderFont" = true;
};
}
)
(
{ colors }:
{
xresources.properties = with colors.withHashtag; {
"*foreground" = base05;
"*background" = base00;
"*cursorColor" = base05;
"*color0" = base00;
"*color1" = base08;
"*color2" = base0B;
"*color3" = base0A;
"*color4" = base0D;
"*color5" = base0E;
"*color6" = base0C;
"*color7" = base05;
"*color8" = base03;
"*color9" = base09;
"*color10" = base01;
"*color11" = base02;
"*color12" = base04;
"*color13" = base06;
"*color14" = base0F;
"*color15" = base07;
};
}
)
];
}

View file

@ -1,35 +1,32 @@
{
config,
lib,
...
}:
{
options.stylix.targets.zed.enable = config.lib.stylix.mkEnableTarget "zed" true;
{ mkTarget, ... }:
mkTarget {
name = "zed";
humanName = "zed";
config =
lib.mkIf
(
config.stylix.enable
&& config.stylix.targets.zed.enable
&& config.programs.zed-editor.enable
)
configElements = [
(
{ fonts }:
{
programs.zed-editor = {
userSettings =
let
inherit (config.stylix) fonts;
in
{
"buffer_font_family" = fonts.monospace.name;
"buffer_font_size" = fonts.sizes.terminal * 4.0 / 3.0;
"theme" = "Base16 ${config.lib.stylix.colors.scheme-name}";
"ui_font_family" = fonts.sansSerif.name;
"ui_font_size" = fonts.sizes.applications * 4.0 / 3.0;
};
themes.stylix = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.tinted-zed;
userSettings = {
"buffer_font_family" = fonts.monospace.name;
"buffer_font_size" = fonts.sizes.terminal * 4.0 / 3.0;
"ui_font_family" = fonts.sansSerif.name;
"ui_font_size" = fonts.sizes.applications * 4.0 / 3.0;
};
};
};
}
)
(
{ colors, inputs }:
{
programs.zed-editor = {
userSettings.theme = "Base16 ${colors.scheme-name}";
themes.stylix = colors {
templateRepo = inputs.tinted-zed;
};
};
}
)
];
}

View file

@ -1,34 +1,27 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "zellij";
humanName = "zellij";
{
options.stylix.targets.zellij.enable =
config.lib.stylix.mkEnableTarget "zellij" true;
config =
lib.mkIf
(
config.stylix.enable
&& config.stylix.targets.zellij.enable
&& config.programs.zellij.enable
)
{
programs.zellij.themes.stylix = {
themes = with config.lib.stylix.colors.withHashtag; {
default = {
bg = base03;
fg = base05;
red = base01;
green = base0B;
blue = base0D;
yellow = base0A;
magenta = base0E;
orange = base09;
cyan = base0C;
black = base00;
white = base07;
};
configElements =
{ colors }:
{
programs.zellij.themes.stylix = {
themes = with colors.withHashtag; {
default = {
bg = base03;
fg = base05;
red = base01;
green = base0B;
blue = base0D;
yellow = base0A;
magenta = base0E;
orange = base09;
cyan = base0C;
black = base00;
white = base07;
};
};
};
};
}