Skip to content

Commit

Permalink
Update colorscheme conf
Browse files Browse the repository at this point in the history
1. remove some colorscheme that doesn't work well with Markdown
2. change how the colorscheme conf is organized.
  • Loading branch information
jdhao committed Feb 1, 2024
1 parent 8416508 commit 7cf70f3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 105 deletions.
155 changes: 53 additions & 102 deletions lua/colorschemes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,120 +6,71 @@ local M = {}

-- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily
-- the same as the colorscheme name itself.
M.colorscheme2dir = {
onedark = "onedark.nvim",
edge = "edge",
sonokai = "sonokai",
gruvbox_material = "gruvbox-material",
nord = "nord.nvim",
everforest = "everforest",
nightfox = "nightfox.nvim",
kanagawa = "kanagawa.nvim",
catppuccin = "catppuccin",
onedarkpro = "onedarkpro.nvim",
monokai = "monokai.nvim",
material = "material.nvim",
M.colorscheme_conf = {
onedark = function()
vim.cmd([[colorscheme onedark]])
end,
edge = function()
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 = "material"
--background option can be hard, medium, soft
vim.g.gruvbox_material_background = "soft"
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_enable_italic = 1
vim.g.everforest_better_performance = 1

vim.cmd([[colorscheme everforest]])
end,
nightfox = function()
vim.cmd([[colorscheme nordfox]])
end,
catppuccin = function()
-- available option: latte, frappe, macchiato, mocha
vim.g.catppuccin_flavour = "frappe"
require("catppuccin").setup()

vim.cmd([[colorscheme catppuccin]])
end,
onedarkpro = function()
-- set colorscheme after options
vim.cmd('colorscheme onedark_vivid')
end,
material = function()
vim.g.material_style = "oceanic"
vim.cmd('colorscheme material')
end,
}

M.gruvbox8 = function()
-- Italic options should be put before colorscheme setting,
-- see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
vim.g.gruvbox_italics = 1
vim.g.gruvbox_italicize_strings = 1
vim.g.gruvbox_filetype_hi_groups = 1
vim.g.gruvbox_plugin_hi_groups = 1

vim.cmd([[colorscheme gruvbox8_hard]])
end

M.onedark = function()
vim.cmd([[colorscheme onedark]])
end

M.edge = function()
vim.g.edge_enable_italic = 1
vim.g.edge_better_performance = 1

vim.cmd([[colorscheme edge]])
end

M.sonokai = function()
vim.g.sonokai_enable_italic = 1
vim.g.sonokai_better_performance = 1

vim.cmd([[colorscheme sonokai]])
end

M.gruvbox_material = function()
-- foreground option can be material, mix, or original
vim.g.gruvbox_material_foreground = "material"
--background option can be hard, medium, soft
vim.g.gruvbox_material_background = "soft"
vim.g.gruvbox_material_enable_italic = 1
vim.g.gruvbox_material_better_performance = 1

vim.cmd([[colorscheme gruvbox-material]])
end

M.nord = function()
vim.cmd([[colorscheme nord]])
end

M.doom_one = function()
vim.cmd([[colorscheme doom-one]])
end

M.everforest = function()
vim.g.everforest_enable_italic = 1
vim.g.everforest_better_performance = 1

vim.cmd([[colorscheme everforest]])
end

M.nightfox = function()
vim.cmd([[colorscheme nordfox]])
end

M.kanagawa = function()
vim.cmd([[colorscheme kanagawa]])
end

M.catppuccin = function()
-- available option: latte, frappe, macchiato, mocha
vim.g.catppuccin_flavour = "frappe"

require("catppuccin").setup()

vim.cmd([[colorscheme catppuccin]])
end

M.onedarkpro = function()
-- set colorscheme after options
vim.cmd('colorscheme onedark_vivid')
end

M.monokai = function()
vim.cmd('colorscheme monokai_pro')
end

M.material = function ()
vim.g.material_style = "oceanic"
vim.cmd('colorscheme material')
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.colorscheme2dir))
local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme_conf))

if not vim.tbl_contains(vim.tbl_keys(M), colorscheme) then
if not vim.tbl_contains(vim.tbl_keys(M.colorscheme_conf), colorscheme) then
local msg = "Invalid colorscheme: " .. colorscheme
vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })

return
end

-- Load the colorscheme and its settings
M[colorscheme]()
M.colorscheme_conf[colorscheme]()

if vim.g.logging_level == "debug" then
local msg = "Colorscheme: " .. colorscheme
Expand Down
3 changes: 0 additions & 3 deletions lua/plugin_specs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,10 @@ local plugin_specs = {
{ "sainnhe/edge", lazy = true },
{ "sainnhe/sonokai", lazy = true },
{ "sainnhe/gruvbox-material", lazy = true },
{ "shaunsingh/nord.nvim", lazy = true },
{ "sainnhe/everforest", lazy = true },
{ "EdenEast/nightfox.nvim", lazy = true },
{ "rebelot/kanagawa.nvim", lazy = true },
{ "catppuccin/nvim", name = "catppuccin", lazy = true },
{ "olimorris/onedarkpro.nvim", lazy = true },
{ "tanvirtin/monokai.nvim", lazy = true },
{ "marko-cerovac/material.nvim", lazy = true },

{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
Expand Down

0 comments on commit 7cf70f3

Please sign in to comment.