Merge pull request #299 from FrothyMarrow/transparent-oxocarbon

theme: add minimal transparency support for oxocarbon
This commit is contained in:
raf 2024-05-23 14:30:47 +00:00 committed by GitHub
commit 5748bb5eb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 15 deletions

View File

@ -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.

View File

@ -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},
},
})

View File

@ -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 {