From f7b1b238f7bc109f0c61f174560ed37ee603a876 Mon Sep 17 00:00:00 2001 From: Laszlo Bacsi Date: Fri, 13 Jun 2025 18:45:49 +0200 Subject: [PATCH] themes/solarized: init --- docs/release-notes/rl-0.8.md | 8 +++- modules/plugins/theme/supported-themes.nix | 44 +++++++++++++++++++++- npins/sources.json | 16 ++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index d9007a12..979586ac 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -426,4 +426,10 @@ [theutz](https://github.com/theutz): -- Added "auto" flavour for catppuccin theme \ No newline at end of file +- 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 diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 722f6d65..d0777a84 100644 --- a/modules/plugins/theme/supported-themes.nix +++ b/modules/plugins/theme/supported-themes.nix @@ -2,7 +2,9 @@ config, lib, }: 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.nvim.lua) toLuaObject; 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"]; }; + + 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 = { setup = {transparent ? false, ...}: '' require("solarized-osaka").setup({ diff --git a/npins/sources.json b/npins/sources.json index f98d517e..b5d796c4 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -2261,6 +2261,22 @@ "url": "https://api.github.com/repos/folke/snacks.nvim/tarball/v2.22.0", "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": { "type": "Git", "repository": {