nix/common/rice/default.nix
2026-04-08 11:51:33 +10:00

90 lines
2.3 KiB
Nix

{
lib,
inputs,
...
}:
let
nix-rice = import "${inputs.nix-rice}/lib.nix" {
inherit lib;
kitty-themes-src = { };
};
inherit (nix-rice) kitty-themes;
inherit (nix-rice.palette) toRGBShortHex toRGBHex;
theme = kitty-themes.parseTheme ./pal.conf;
in
{
options.rice = lib.mkOption {
description = "ricing related variables";
default = { };
type = lib.types.attrsOf lib.types.anything;
};
config.rice = rec {
# first, map straight colours
palette = theme // {
normal = {
black = theme.color0;
red = theme.color1;
green = theme.color2;
yellow = theme.color3;
blue = theme.color4;
magenta = theme.color5;
cyan = theme.color6;
white = theme.color7;
};
bright = {
black = theme.color8;
red = theme.color9;
green = theme.color10;
yellow = theme.color11;
blue = theme.color12;
magenta = theme.color13;
cyan = theme.color14;
white = theme.color15;
};
util = {
fg = theme.foreground;
bg = theme.background;
fg_sel = theme.selection_foreground;
bg_sel = theme.selection_background;
inherit (theme) cursor;
# url = theme.url_color;
};
hex = toRGBHex palette;
shortHex = toRGBShortHex palette;
};
# then map colours to roles
# these are general UI roles — not code-syntax tokens.
# editors and shells should use palette directly for syntax.
roles = p: {
# base
fg = p.util.fg;
bg = p.util.bg;
surface = p.normal.black; # panels, popups, recessed areas
overlay = p.bright.black; # menus, statuslines, elevated UI
muted = p.normal.white; # secondary text, inactive borders
# emphasis
primary = p.normal.red; # main interactive accent
secondary = p.bright.blue; # secondary interactive accent
accent = p.bright.magenta; # highlights, matches
highlight = p.bright.yellow; # selection, active borders, branding
# state
success = p.bright.green;
warning = p.normal.yellow;
error = p.bright.red;
info = p.bright.cyan;
hint = p.bright.blue;
# diff
added = p.normal.green;
changed = p.bright.yellow;
removed = p.normal.red;
};
};
}