1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00
jdhao-nvim-config/lua/colorschemes.lua
jdhao b82c1c112f
update colorscheme (#390)
1. Remove catppuccin, it is too purple/blue for me
2. use another nightfox variant
2025-03-30 18:02:28 +02:00

81 lines
2.2 KiB
Lua

--- This module will load a random colorscheme on nvim startup process.
local utils = require("utils")
local M = {}
-- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily
-- the same as the colorscheme name itself.
M.colorscheme_conf = {
onedark = function()
-- Lua
require("onedark").setup {
style = "darker",
}
require("onedark").load()
end,
edge = function()
vim.g.edge_style = "default"
vim.g.edge_enable_italic = 1
vim.g.edge_better_performance = 1
vim.cmd([[colorscheme edge]])
end,
sonokai = function()
vim.g.sonokai_enable_italic = 1
vim.g.sonokai_better_performance = 1
vim.cmd([[colorscheme sonokai]])
end,
gruvbox_material = function()
-- foreground option can be material, mix, or original
vim.g.gruvbox_material_foreground = "original"
--background option can be hard, medium, soft
vim.g.gruvbox_material_background = "hard"
vim.g.gruvbox_material_enable_italic = 1
vim.g.gruvbox_material_better_performance = 1
vim.cmd([[colorscheme gruvbox-material]])
end,
everforest = function()
vim.g.everforest_background = "hard"
vim.g.everforest_enable_italic = 1
vim.g.everforest_better_performance = 1
vim.cmd([[colorscheme everforest]])
end,
nightfox = function()
vim.cmd([[colorscheme carbonfox]])
end,
onedarkpro = function()
-- set colorscheme after options
-- onedark_vivid does not enough contrast
vim.cmd("colorscheme onedark_dark")
end,
material = function()
vim.g.material_style = "darker"
vim.cmd("colorscheme material")
end,
arctic = function()
vim.cmd("colorscheme arctic")
end,
kanagawa = function()
vim.cmd("colorscheme kanagawa-wave")
end,
}
--- Use a random colorscheme from the pre-defined list of colorschemes.
M.rand_colorscheme = function()
local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme_conf))
-- Load the colorscheme and its settings
M.colorscheme_conf[colorscheme]()
if vim.g.logging_level == "debug" then
local msg = "Colorscheme: " .. colorscheme
vim.notify(msg, vim.log.levels.DEBUG, { title = "nvim-config" })
end
end
return M