From fc4e4714903afc3eb5a0d4ddb25ed95f9dfdd0f6 Mon Sep 17 00:00:00 2001 From: Frothy <76622149+FrothyMarrow@users.noreply.github.com> Date: Thu, 23 May 2024 09:51:05 -0400 Subject: [PATCH 1/2] theme: add minimal transparency support for oxocarbon --- modules/plugins/theme/supported_themes.nix | 37 +++++++++++++++------- modules/plugins/theme/theme.nix | 4 ++- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/modules/plugins/theme/supported_themes.nix b/modules/plugins/theme/supported_themes.nix index dbddd11..bcc2c27 100644 --- a/modules/plugins/theme/supported_themes.nix +++ b/modules/plugins/theme/supported_themes.nix @@ -1,4 +1,10 @@ -{lib}: { +{ + config, + lib, +}: let + inherit (lib.strings) optionalString; + inherit (lib.trivial) boolToString warnIf; +in { onedark = { setup = { style ? "dark", @@ -19,7 +25,7 @@ transparent, }: '' require('tokyonight').setup { - transparent = ${lib.boolToString transparent}; + transparent = ${boolToString transparent}; } vim.cmd[[colorscheme tokyonight-${style}]] ''; @@ -32,7 +38,7 @@ transparent, }: '' require('dracula').setup({ - transparent_bg = ${lib.boolToString transparent}, + transparent_bg = ${boolToString transparent}, }); require('dracula').load(); ''; @@ -46,11 +52,11 @@ -- Catppuccin theme require('catppuccin').setup { flavour = "${style}", - transparent_background = ${lib.boolToString transparent}, + transparent_background = ${boolToString transparent}, integrations = { nvimtree = { enabled = true, - transparent_panel = ${lib.boolToString transparent}, + transparent_panel = ${boolToString transparent}, show_root = true, }, @@ -85,11 +91,20 @@ transparent ? false, }: let style' = - lib.warnIf (style == "light") "oxocarbon: light theme is not well-supported" style; + warnIf (style == "light") "oxocarbon: light theme is not well-supported" style; in '' - require('oxocarbon') - vim.opt.background = "${style'}" - vim.cmd.colorscheme = "oxocarbon" + require('oxocarbon') + vim.opt.background = "${style'}" + vim.cmd.colorscheme = "oxocarbon" + ${optionalString transparent '' + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + vim.api.nvim_set_hl(0, "LineNr", { bg = "none" }) + vim.api.nvim_set_hl(0, "SignColumn", { bg = "none" }) + ${lib.optionalString config.vim.filetree.nvimTree.enable '' + vim.api.nvim_set_hl(0, "NvimTreeNormal", { bg = "none" }) + ''} + ''} ''; styles = ["dark" "light"]; }; @@ -122,7 +137,7 @@ palette_overrides = {}, overrides = {}, dim_inactive = false, - transparent_mode = ${lib.boolToString transparent}, + transparent_mode = ${boolToString transparent}, }) vim.o.background = "${style}" vim.cmd("colorscheme gruvbox") @@ -147,7 +162,7 @@ styles = { bold = false, italic = false, -- I would like to add more options for this - transparency = ${lib.boolToString transparent}, + transparency = ${boolToString transparent}, }, }) diff --git a/modules/plugins/theme/theme.nix b/modules/plugins/theme/theme.nix index 2ae3e45..9426378 100644 --- a/modules/plugins/theme/theme.nix +++ b/modules/plugins/theme/theme.nix @@ -10,7 +10,9 @@ inherit (lib.nvim.dag) entryBefore; cfg = config.vim.theme; - supported_themes = import ./supported_themes.nix {inherit lib;}; + supported_themes = import ./supported_themes.nix { + inherit lib config; + }; in { options.vim.theme = { enable = mkOption { From 367320dcd9b193dac944d3a1d685f51888f11dc8 Mon Sep 17 00:00:00 2001 From: Frothy <76622149+FrothyMarrow@users.noreply.github.com> Date: Thu, 23 May 2024 10:00:20 -0400 Subject: [PATCH 2/2] docs: add entry for transparency support for oxocarbon --- docs/release-notes/rl-0.7.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 1dc5bc0..ca49c7d 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -6,7 +6,7 @@ Release notes for release 0.7 [ItsSorae](https://github.com/ItsSorae): -- Added support for [typst](https://typst.app/) under `vim.languages.typst` This +- Add support for [typst](https://typst.app/) under `vim.languages.typst` This will enable the `typst-lsp` language server, and the `typstfmt` formatter [frothymarrow](https://github.com/frothymarrow): @@ -15,6 +15,9 @@ Release notes for release 0.7 [](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from `anything` to a `submodule` for better type checking. - Fix null `vim.lsp.mappings` generating an error and not being filtered out. +- Add basic transparency support for `oxocarbon` theme by setting the + highlight group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and + optionally `NvimTreeNormal` to `none`. [horriblename](https://github.com/horriblename): @@ -38,9 +41,9 @@ Release notes for release 0.7 - Remove vim-tidal and friends -- Cleaned up Lualine module to reduce theme dependency on Catppuccin, and fixed +- Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed blending issues in component separators. [jacekpoz](https://github.com/jacekpoz): -- Added [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support. +- Add [ocaml-lsp](https://github.com/ocaml/ocaml-lsp) support.