themes/solarized: init

This commit is contained in:
Laszlo Bacsi 2025-06-13 18:45:49 +02:00
commit f7b1b238f7
No known key found for this signature in database
GPG key ID: 7AC6E86EE9E48853
3 changed files with 66 additions and 2 deletions

View file

@ -426,4 +426,10 @@
[theutz](https://github.com/theutz): [theutz](https://github.com/theutz):
- Added "auto" flavour for catppuccin theme - Added "auto" flavour for catppuccin theme
[lackac](https://github.com/lackac):
[solarized.nvim]: https://github.com/maxmx03/solarized.nvim
- Add [solarized.nvim] theme with support for multiple variants

View file

@ -2,7 +2,9 @@
config, config,
lib, lib,
}: let }: let
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString splitString;
inherit (lib.attrsets) mapCartesianProduct;
inherit (lib.lists) intersectLists;
inherit (lib.trivial) boolToString warnIf; inherit (lib.trivial) boolToString warnIf;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
in { in {
@ -217,6 +219,46 @@ in {
''; '';
styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"]; styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"];
}; };
solarized = let
backgrounds = ["light" "dark"];
palettes = ["solarized" "selenized"];
variants = ["spring" "summer" "autumn" "winter"];
in {
setup = {
style ? "", # use plugin defaults
transparent ? false,
...
}: let
parts = splitString "-" style;
detect = list:
let intersection = intersectLists parts list;
in if intersection == [] then null else builtins.head intersection;
background = detect backgrounds;
palette = detect palettes;
variant = detect variants;
in ''
-- Solarized theme
require('solarized').setup {
transparent = {
enabled = ${boolToString transparent},
},
${optionalString (!isNull palette) ''palette = "${palette}",''}
${optionalString (!isNull variant) ''variant = "${variant}",''}
}
${optionalString (!isNull background) ''vim.opt.background = "${background}"''}
vim.cmd.colorscheme "solarized"
'';
styles = let
joinWithDashes = parts: lib.concatStringsSep "-" (lib.filter (s: s != "") parts);
combinations = mapCartesianProduct ({bg, pal, var}: joinWithDashes [bg pal var]) {
bg = [""] ++ backgrounds;
pal = [""] ++ palettes;
var = [""] ++ variants;
};
in lib.filter (s: s != "") combinations;
};
solarized-osaka = { solarized-osaka = {
setup = {transparent ? false, ...}: '' setup = {transparent ? false, ...}: ''
require("solarized-osaka").setup({ require("solarized-osaka").setup({

View file

@ -2261,6 +2261,22 @@
"url": "https://api.github.com/repos/folke/snacks.nvim/tarball/v2.22.0", "url": "https://api.github.com/repos/folke/snacks.nvim/tarball/v2.22.0",
"hash": "1hbm4fnw51qdp0nz83fcxbvnxjq2k57a37w6dp0wz6wkcx7cwxw9" "hash": "1hbm4fnw51qdp0nz83fcxbvnxjq2k57a37w6dp0wz6wkcx7cwxw9"
}, },
"solarized": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "maxmx03",
"repo": "solarized.nvim"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v3.6.0",
"revision": "c0dfe1cbfabd93b546baf5f1408f5df7e02e2050",
"url": "https://api.github.com/repos/maxmx03/solarized.nvim/tarball/v3.6.0",
"hash": "1fz1wc569w26aanmj3hhsc17xrx29g6bfsjsbgssa7jq76aavp3w"
},
"solarized-osaka": { "solarized-osaka": {
"type": "Git", "type": "Git",
"repository": { "repository": {