11.stylix/modules/gitui/hm.nix
Jalil David Salamé Messina 7682713f6a
stylix: add 'stylix.enable' option (#244)
Add a 'stylix.enable' option to enable or disable all Stylix modules in
order to resolve issues similar to [2].

To align with the default 'lib.mkEnableOption' [1] behavior,
'stylix.enable' defaults to 'false'.

BREAKING CHANGE: Stylix is disabled by default. To enable it, use:

    stylix.enable = true;

[1]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/options.nix#L91-L105
[2]: https://github.com/danth/stylix/issues/216

Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com>
Co-authored-by: Jalil David Salamé Messina <jalil.salame@gmail.com>
Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
2024-06-10 11:52:47 +02:00

44 lines
1.5 KiB
Nix

{ config, lib, ... }:
let
inherit (config.lib.stylix) colors;
mkRgb = color:
let
r = colors."${color}-rgb-r";
g = colors."${color}-rgb-g";
b = colors."${color}-rgb-b";
in
"Rgb(${r}, ${g}, ${b})";
in
{
options.stylix.targets.gitui.enable =
config.lib.stylix.mkEnableTarget "GitUI" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.gitui.enable) {
programs.gitui.theme = ''
(
selected_tab: Some(Reset),
command_fg: Some(${mkRgb "base05"}),
selection_bg: Some(${mkRgb "base04"}),
selection_fg: Some(${mkRgb "base05"}),
cmdbar_bg: Some(${mkRgb "base01"}),
cmdbar_extra_lines_bg: Some(${mkRgb "base01"}),
disabled_fg: Some(${mkRgb "base04"}),
diff_line_add: Some(${mkRgb "base0B"}),
diff_line_delete: Some(${mkRgb "base08"}),
diff_file_added: Some(${mkRgb "base0A"}),
diff_file_removed: Some(${mkRgb "base08"}),
diff_file_moved: Some(${mkRgb "base0E"}),
diff_file_modified: Some(${mkRgb "base09"}),
commit_hash: Some(${mkRgb "base07"}),
commit_time: Some(${mkRgb "base05"}),
commit_author: Some(${mkRgb "base0D"}),
danger_fg: Some(${mkRgb "base08"}),
push_gauge_bg: Some(${mkRgb "base0D"}),
push_gauge_fg: Some(${mkRgb "base00"}),
tag_fg: Some(${mkRgb "base06"}),
branch_fg: Some(${mkRgb "base0C"})
)
'';
};
}