summaryrefslogtreecommitdiff
path: root/lua/lvim/core/theme.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2022-11-02 11:29:07 +0100
committerGitHub <[email protected]>2022-11-02 11:29:07 +0100
commit8d3f9b8bf7f5fddca2e8046a84ecbd7c3945dcba (patch)
tree4d6063d12004ae737347368deb08d3873d74b618 /lua/lvim/core/theme.lua
parent375232c95a45d917b201b4398ac173202e59e87f (diff)
refactor(theme)!: decouple tokyonight options (#3384)
Diffstat (limited to 'lua/lvim/core/theme.lua')
-rw-r--r--lua/lvim/core/theme.lua126
1 files changed, 49 insertions, 77 deletions
diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua
index efe2b404..04186b0b 100644
--- a/lua/lvim/core/theme.lua
+++ b/lua/lvim/core/theme.lua
@@ -5,83 +5,51 @@ local M = {}
M.config = function()
lvim.builtin.theme = {
name = "tokyonight",
- options = {
- on_highlights = function(hl, c)
- hl.IndentBlanklineContextChar = {
- fg = c.dark5,
- }
- hl.TSConstructor = {
- fg = c.blue1,
- }
- hl.TSTagDelimiter = {
- fg = c.dark5,
- }
- -- local prompt = "#2d3149"
- -- hl.TelescopeNormal = {
- -- bg = c.bg_dark,
- -- fg = c.fg_dark,
- -- }
- -- hl.TelescopeBorder = {
- -- bg = c.bg_dark,
- -- fg = c.bg_dark,
- -- }
- -- hl.TelescopePromptNormal = {
- -- bg = prompt,
- -- }
- -- hl.TelescopePromptBorder = {
- -- bg = prompt,
- -- fg = prompt,
- -- }
- -- hl.TelescopePromptTitle = {
- -- bg = prompt,
- -- fg = prompt,
- -- }
- -- hl.TelescopePreviewTitle = {
- -- bg = c.bg_dark,
- -- fg = c.bg_dark,
- -- }
- -- hl.TelescopeResultsTitle = {
- -- bg = c.bg_dark,
- -- fg = c.bg_dark,
- -- }
- end,
- style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day`
- transparent = lvim.transparent_window, -- Enable this to disable setting the background color
- terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
- styles = {
- -- Style to be applied to different syntax groups
- -- Value is any valid attr-list value for `:help nvim_set_hl`
- comments = { italic = true },
- keywords = { italic = true },
- functions = {},
- variables = {},
- -- Background styles. Can be "dark", "transparent" or "normal"
- sidebars = "dark", -- style for sidebars, see below
- floats = "dark", -- style for floating windows
+ tokyonight = {
+ options = {
+ on_highlights = function(hl, c)
+ hl.IndentBlanklineContextChar = {
+ fg = c.dark5,
+ }
+ hl.TSConstructor = {
+ fg = c.blue1,
+ }
+ hl.TSTagDelimiter = {
+ fg = c.dark5,
+ }
+ end,
+ style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day`
+ transparent = lvim.transparent_window, -- Enable this to disable setting the background color
+ terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
+ styles = {
+ -- Style to be applied to different syntax groups
+ -- Value is any valid attr-list value for `:help nvim_set_hl`
+ comments = { italic = true },
+ keywords = { italic = true },
+ functions = {},
+ variables = {},
+ -- Background styles. Can be "dark", "transparent" or "normal"
+ sidebars = "dark", -- style for sidebars, see below
+ floats = "dark", -- style for floating windows
+ },
+ -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
+ sidebars = {
+ "qf",
+ "vista_kind",
+ "terminal",
+ "packer",
+ "spectre_panel",
+ "NeogitStatus",
+ "help",
+ },
+ day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
+ hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
+ dim_inactive = false, -- dims inactive windows
+ lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
+ use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background
},
- -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
- sidebars = {
- "qf",
- "vista_kind",
- "terminal",
- "packer",
- "spectre_panel",
- "NeogitStatus",
- "help",
- },
- day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
- hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
- dim_inactive = false, -- dims inactive windows
- lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
- use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background
},
}
- local status_ok, theme = pcall(require, "tokyonight")
- if not status_ok then
- return
- end
-
- theme.setup(lvim.builtin.theme.options)
end
M.setup = function()
@@ -91,10 +59,14 @@ M.setup = function()
return
end
- local status_ok, theme = pcall(require, "tokyonight")
- if status_ok and theme then
- theme.setup(lvim.builtin.theme.options)
+ local selected_theme = lvim.builtin.theme.name
+ local status_ok, plugin = pcall(require, selected_theme)
+ if not status_ok then
+ return
end
+ pcall(function()
+ plugin.setup(lvim.builtin.theme[selected_theme].options)
+ end)
-- ref: https://github.com/neovim/neovim/issues/18201#issuecomment-1104754564
local colors = vim.api.nvim_get_runtime_file(("colors/%s.*"):format(lvim.colorscheme), false)