1

Compare commits

..

7 Commits

6 changed files with 98 additions and 55 deletions

View File

@ -45,20 +45,47 @@ in {
lightDefs = import ./schemes/${color.lightScheme}.nix; lightDefs = import ./schemes/${color.lightScheme}.nix;
darkDefs = import ./schemes/${color.darkScheme}.nix; darkDefs = import ./schemes/${color.darkScheme}.nix;
mkLightColorAssignment = key: {${key} = lightDefs.${key};}; mkColorAssignment = defs: key: {${key} = defs.${key};};
mkDarkColorAssignment = key: {${key} = darkDefs.${key};}; mkRgbColorAssignment = defs: key: {${key} = mylib.color.hexToRGB defs.${key};};
mkRgbStringColorAssignment = defs: key: {${key} = mylib.color.hexToRGBString "," defs.${key};};
in in
lib.mkIf color.enable { lib.mkIf color.enable {
# This module sets its own options # This module sets its own options
# to the values specified in a colorscheme file. # to the values specified in a colorscheme file.
modules.color.light = lib.pipe colorKeys [ modules.color = {
(builtins.map mkLightColorAssignment) light = lib.pipe colorKeys [
(builtins.map (mkColorAssignment lightDefs))
lib.mergeAttrsList lib.mergeAttrsList
]; ];
modules.color.dark = lib.pipe colorKeys [ dark = lib.pipe colorKeys [
(builtins.map mkDarkColorAssignment) (builtins.map (mkColorAssignment darkDefs))
lib.mergeAttrsList
];
rgb = {
light = lib.pipe colorKeys [
(builtins.map (mkRgbColorAssignment lightDefs))
lib.mergeAttrsList
];
dark = lib.pipe colorKeys [
(builtins.map (mkRgbColorAssignment darkDefs))
lib.mergeAttrsList lib.mergeAttrsList
]; ];
}; };
rgbString = {
light = lib.pipe colorKeys [
(builtins.map (mkRgbStringColorAssignment lightDefs))
lib.mergeAttrsList
];
dark = lib.pipe colorKeys [
(builtins.map (mkRgbStringColorAssignment darkDefs))
lib.mergeAttrsList
];
};
};
};
} }

View File

@ -62,4 +62,14 @@ in
type = types.attrs; type = types.attrs;
description = "Colors belonging to the selected dark scheme"; description = "Colors belonging to the selected dark scheme";
}; };
rgbString = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme in 'RR,GG,BB' format";
};
rgb = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme in '[RR GG BB]' format";
};
} }

View File

@ -34,17 +34,14 @@ in {
sidebar-mode = false; sidebar-mode = false;
}; };
# bg-col: rgba(239, 241, 245, 60%);
theme = let theme = let
inherit (config.lib.formats.rasi) mkLiteral; inherit (config.lib.formats.rasi) mkLiteral;
mkColor = color: mkLiteral "#{color}";
in { in {
"*" = { "*" = {
bg = mkLiteral "rgba(239, 241, 245, 0.3)"; bg = mkLiteral "rgba(${color.rgbString.light.base}, 0.3)";
hl = mkLiteral "#${color.dark.lavender}"; hl = mkLiteral "#${color.dark.lavender}";
text = mkLiteral "#${color.dark.base}"; text = mkLiteral "#${color.dark.base}";
trans = mkLiteral "rgba(255, 255, 255, 0)"; trans = mkLiteral "rgba(0, 0, 0, 0)";
}; };
"element-text,element-icon,mode-switcher" = { "element-text,element-icon,mode-switcher" = {
@ -121,7 +118,7 @@ in {
margin = 0; margin = 0;
background-color = mkLiteral "@trans"; background-color = mkLiteral "@trans";
text-color = mkLiteral "@text"; text-color = mkLiteral "@text";
border-radius = 3; # border-radius = 3;
}; };
"element-icon" = { "element-icon" = {

View File

@ -97,7 +97,7 @@ in {
border-color: #${color.dark.lavender}; border-color: #${color.dark.lavender};
/*Can't use color.light.base here because waybar doesn't support rrggbbaa :(*/ /*Can't use color.light.base here because waybar doesn't support rrggbbaa :(*/
background-color: rgba(239, 241, 245, 0.3); background-color: rgba(${color.rgbString.light.base}, 0.3);
} }
/*Colors*/ /*Colors*/
@ -105,7 +105,7 @@ in {
#user {background-color: #${color.dark.pink};} #user {background-color: #${color.dark.pink};}
#window {background-color: #${color.dark.mauve};} #window {background-color: #${color.dark.mauve};}
#workspaces button {background-color: #${color.dark.lavender};} #workspaces button {background-color: #${color.dark.lavender};}
#workspaces button.active {background-color: #${color.dark.sapphire};} #workspaces button.active {background-color: #${color.dark.pink};}
#pulseaudio {background-color: #${color.dark.maroon};} #pulseaudio {background-color: #${color.dark.maroon};}
#network {background-color: #${color.dark.peach};} #network {background-color: #${color.dark.peach};}
#cpu {background-color: #${color.dark.yellow};} #cpu {background-color: #${color.dark.yellow};}

View File

@ -4,7 +4,7 @@
mylib, mylib,
... ...
}: let }: let
inherit (config.modules) zathura; inherit (config.modules) zathura color;
in { in {
options.modules.zathura = import ./options.nix {inherit lib mylib;}; options.modules.zathura = import ./options.nix {inherit lib mylib;};
@ -12,47 +12,56 @@ in {
programs.zathura = { programs.zathura = {
enable = true; enable = true;
# TODO: Set database backend options = rec {
# TODO: Use color module n-completion-items = 10;
options = { font = "${color.font} 11";
# Catppuccin Latte guioptions = "s"; # s - statusbar, c - command line
default-fg = "#4C4F69"; database = "sqlite";
default-bg = "#EFF1F5"; adjust-open = "best-fit";
recolor-keephue = true;
statusbar-basename = true;
statusbar-home-tilde = true;
window-title-basename = statusbar-basename;
window-title-home-tilde = statusbar-home-tilde;
completion-bg = "#CCD0DA"; # Colorscheme
completion-fg = "#4C4F69"; default-bg = "#${color.light.base}";
completion-highlight-bg = "#575268"; default-fg = "#${color.light.text}";
completion-highlight-fg = "#4C4F69";
completion-group-bg = "#CCD0DA";
completion-group-fg = "#1E66F5";
statusbar-fg = "#4C4F69"; highlight-color = "rgba(${color.rgbString.dark.lavender}, 0.5)";
statusbar-bg = "#CCD0DA"; highlight-fg = "rgba(${color.rgbString.dark.green}, 0.5)";
highlight-active-color = "rgba(${color.rgbString.dark.pink}, 0.5)";
notification-bg = "#CCD0DA"; statusbar-bg = "#${color.dark.lavender}";
notification-fg = "#4C4F69"; statusbar-fg = default-fg;
notification-error-bg = "#CCD0DA";
notification-error-fg = "#D20F39";
notification-warning-bg = "#CCD0DA";
notification-warning-fg = "#FAE3B0";
inputbar-fg = "#4C4F69"; inputbar-bg = statusbar-bg;
inputbar-bg = "#CCD0DA"; inputbar-fg = statusbar-fg;
recolor-lightcolor = "#EFF1F5"; completion-bg = "#${color.light.surface0}";
recolor-darkcolor = "#4C4F69"; completion-fg = default-fg;
completion-highlight-bg = statusbar-bg;
completion-highlight-fg = completion-fg;
completion-group-bg = completion-bg;
completion-group-fg = completion-fg;
index-fg = "#4C4F69"; notification-bg = completion-bg;
index-bg = "#EFF1F5"; notification-fg = default-fg;
index-active-fg = "#4C4F69"; notification-warning-bg = notification-bg;
index-active-bg = "#CCD0DA"; notification-warning-fg = "#${color.light.peach}";
notification-error-bg = notification-bg;
notification-error-fg = "#${color.light.red}";
render-loading-bg = "#EFF1F5"; recolor-lightcolor = default-bg;
render-loading-fg = "#4C4F69"; recolor-darkcolor = default-fg;
highlight-color = "#575268"; index-bg = default-bg;
highlight-fg = "#EA76CB"; index-fg = default-fg;
highlight-active-color = "#EA76CB"; index-active-bg = completion-highlight-bg;
index-active-fg = completion-highlight-fg;
render-loading-bg = default-bg;
render-loading-fg = default-fg;
}; };
}; };
}; };

View File

@ -26,7 +26,7 @@
}; };
pow = base: exponent: let pow = base: exponent: let
inherit (nixpkgs-lib) mod; inherit (lib) mod;
in in
if exponent > 1 if exponent > 1
then let then let
@ -51,7 +51,7 @@
base16To10 = exponent: scalar: scalar * (pow 16 exponent); base16To10 = exponent: scalar: scalar * (pow 16 exponent);
hexCharToDec = hex: let hexCharToDec = hex: let
inherit (nixpkgs-lib) toLower; inherit (lib) toLower;
lowerHex = toLower hex; lowerHex = toLower hex;
in in
if builtins.stringLength hex != 1 if builtins.stringLength hex != 1
@ -125,7 +125,7 @@ in rec {
*/ */
hexToRGBString = sep: hex: let hexToRGBString = sep: hex: let
inherit (builtins) map toString; inherit (builtins) map toString;
inherit (nixpkgs-lib) concatStringsSep; inherit (lib) concatStringsSep;
hexInRGB = hexToRGB hex; hexInRGB = hexToRGB hex;
hexInRGBString = map toString hexInRGB; hexInRGBString = map toString hexInRGB;
in in