rio: add support for custom themes

This commit is contained in:
Hoang Nguyen 2025-11-03 00:35:27 +07:00 committed by Austin Horstman
parent e22fb25cde
commit 9d6e28fd32
4 changed files with 64 additions and 0 deletions

View file

@ -28,6 +28,25 @@ in
<https://raphamorim.io/rio/docs/#configuration-file> for options.
'';
};
themes = lib.mkOption {
type = with lib.types; attrsOf (either settingsFormat.type path);
default = { };
description = ''
Theme files written to {file}`$XDG_CONFIG_HOME/rio/themes/`. See
<https://rioterm.com/docs/config#building-your-own-theme> for
supported values.
'';
example = lib.literalExpression ''
{
foobar.colors = {
background = "#282a36";
green = "#50fa7b";
dim-green = "#06572f";
};
}
'';
};
};
meta.maintainers = [ lib.maintainers.otavio ];
@ -42,6 +61,16 @@ in
xdg.configFile."rio/config.toml".source =
if lib.isPath cfg.settings then cfg.settings else settingsFormat.generate "rio.toml" cfg.settings;
})
(lib.mkIf (cfg.themes != { }) {
xdg.configFile = lib.mapAttrs' (
name: value:
lib.nameValuePair "rio/themes/${name}.toml" {
source =
if builtins.isPath value then value else settingsFormat.generate "rio-theme-${name}.toml" value;
}
) cfg.themes;
})
]
);
}