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): [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 will enable the `typst-lsp` language server, and the `typstfmt` formatter
[frothymarrow](https://github.com/frothymarrow): [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 [](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from
`anything` to a `submodule` for better type checking. `anything` to a `submodule` for better type checking.
- Fix null `vim.lsp.mappings` generating an error and not being filtered out. - 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): [horriblename](https://github.com/horriblename):
@ -38,9 +41,9 @@ Release notes for release 0.7
- Remove vim-tidal and friends - 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. blending issues in component separators.
[jacekpoz](https://github.com/jacekpoz): [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 = { onedark = {
setup = { setup = {
style ? "dark", style ? "dark",
@ -19,7 +25,7 @@
transparent, transparent,
}: '' }: ''
require('tokyonight').setup { require('tokyonight').setup {
transparent = ${lib.boolToString transparent}; transparent = ${boolToString transparent};
} }
vim.cmd[[colorscheme tokyonight-${style}]] vim.cmd[[colorscheme tokyonight-${style}]]
''; '';
@ -32,7 +38,7 @@
transparent, transparent,
}: '' }: ''
require('dracula').setup({ require('dracula').setup({
transparent_bg = ${lib.boolToString transparent}, transparent_bg = ${boolToString transparent},
}); });
require('dracula').load(); require('dracula').load();
''; '';
@ -46,11 +52,11 @@
-- Catppuccin theme -- Catppuccin theme
require('catppuccin').setup { require('catppuccin').setup {
flavour = "${style}", flavour = "${style}",
transparent_background = ${lib.boolToString transparent}, transparent_background = ${boolToString transparent},
integrations = { integrations = {
nvimtree = { nvimtree = {
enabled = true, enabled = true,
transparent_panel = ${lib.boolToString transparent}, transparent_panel = ${boolToString transparent},
show_root = true, show_root = true,
}, },
@ -85,11 +91,20 @@
transparent ? false, transparent ? false,
}: let }: let
style' = 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 '' in ''
require('oxocarbon') require('oxocarbon')
vim.opt.background = "${style'}" vim.opt.background = "${style'}"
vim.cmd.colorscheme = "oxocarbon" 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"]; styles = ["dark" "light"];
}; };
@ -122,7 +137,7 @@
palette_overrides = {}, palette_overrides = {},
overrides = {}, overrides = {},
dim_inactive = false, dim_inactive = false,
transparent_mode = ${lib.boolToString transparent}, transparent_mode = ${boolToString transparent},
}) })
vim.o.background = "${style}" vim.o.background = "${style}"
vim.cmd("colorscheme gruvbox") vim.cmd("colorscheme gruvbox")
@ -147,7 +162,7 @@
styles = { styles = {
bold = false, bold = false,
italic = false, -- I would like to add more options for this 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; inherit (lib.nvim.dag) entryBefore;
cfg = config.vim.theme; cfg = config.vim.theme;
supported_themes = import ./supported_themes.nix {inherit lib;}; supported_themes = import ./supported_themes.nix {
inherit lib config;
};
in { in {
options.vim.theme = { options.vim.theme = {
enable = mkOption { enable = mkOption {