2023-08-14 13:49:55 +02:00
|
|
|
# Additional theming primitives not provided by stylix
|
|
|
|
{ lib, config, ... }:
|
|
|
|
let cfg = config.satellite.theming;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.satellite.theming = {
|
2023-08-19 21:31:22 +02:00
|
|
|
rounding = {
|
|
|
|
enable = lib.mkEnableOption "rounded corners for desktop apps";
|
|
|
|
radius = lib.mkOption {
|
|
|
|
description = "How much to round corners by deafault";
|
2023-08-28 17:18:26 +02:00
|
|
|
default = 0.0;
|
2023-08-19 21:31:22 +02:00
|
|
|
example = 10;
|
|
|
|
type = lib.types.float;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-08-14 13:49:55 +02:00
|
|
|
get = lib.mkOption {
|
|
|
|
# No generics:(
|
2023-12-10 19:45:28 +01:00
|
|
|
# The type of this is essentially (written in ts-like -pseudocode):
|
2023-08-14 13:49:55 +02:00
|
|
|
#
|
|
|
|
# Record<String, T>
|
2023-12-10 19:45:28 +01:00
|
|
|
# & { default?: T | {light?: T, dark?: T } }
|
|
|
|
# -> Option<T>
|
2023-08-14 13:49:55 +02:00
|
|
|
type = lib.types.functionTo lib.types.anything;
|
|
|
|
description = "Index a theme map by the current theme";
|
|
|
|
};
|
|
|
|
|
|
|
|
colors = {
|
|
|
|
rgb = lib.mkOption {
|
|
|
|
type = lib.types.functionTo lib.types.str;
|
|
|
|
description = "Returns comma separated rgb values for a color. To be used in css files:)";
|
|
|
|
};
|
|
|
|
|
|
|
|
rgba = lib.mkOption {
|
|
|
|
type = lib.types.functionTo lib.types.str;
|
|
|
|
description = ''
|
|
|
|
Returns comma separated rgba values for a color.
|
|
|
|
The transparency is taken from `options.satellite.theming.transparency`.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config.satellite.theming = {
|
2023-08-19 21:31:22 +02:00
|
|
|
rounding.enable = cfg.rounding.radius > 0.0;
|
2023-08-14 13:49:55 +02:00
|
|
|
|
|
|
|
get = themeMap:
|
|
|
|
themeMap.${config.lib.stylix.scheme.scheme}
|
|
|
|
or themeMap.default.${config.stylix.polarity or "dark"}
|
|
|
|
or themeMap.default
|
|
|
|
or (throw "Theme ${config.lib.stylix.scheme.scheme} not found in theme map!");
|
|
|
|
|
|
|
|
colors.rgb = color: builtins.concatStringsSep "," [
|
|
|
|
config.lib.stylix.scheme."${color}-rgb-r"
|
|
|
|
config.lib.stylix.scheme."${color}-rgb-g"
|
|
|
|
config.lib.stylix.scheme."${color}-rgb-b"
|
|
|
|
];
|
|
|
|
|
2023-12-10 19:45:28 +01:00
|
|
|
colors.rgba = color: "${cfg.colors.rgb color},${toString config.stylix.opacity.applications}";
|
2023-08-14 13:49:55 +02:00
|
|
|
};
|
|
|
|
}
|