summaryrefslogtreecommitdiff
path: root/lua/tjk/plugins/colorscheme.lua
blob: bb62cb381051638ed79d7caa92f841b331645e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-- use another colorscheme if running as root
if os.getenv "USER" == "root" then
	vim.cmd.colorscheme "koehler"
	return {}
end

-- disable gruvbox and termguicolors when in a tty
if os.getenv "DISPLAY" == nil then
	vim.opt.termguicolors = false
	return {}
end

return {
	"ellisonleao/gruvbox.nvim",
	priority = 9001,
	config = function()
		vim.o.background = "dark"

		local gruvbox = require("gruvbox")
		local colors = gruvbox.palette

		gruvbox.setup({
			italic = {
				strings = false,
				emphasis = true,
				comments = false,
				operators = false,
				folds = true,
			},
			invert_selection = true,
			contrast = "hard",
			palette_overrides = {
				light0 = "#ffffff",  -- use white instead of the default off-white for text
				light1 = "#ffffff",
				dark2  = "#363636",  -- darker whitespace characters
			},
			overrides = {
				CursorLine = { bg = "#282828" }, -- dark0 (non hard)
				Directory = { link = "GruvboxGreenBold" },
				-- treesitter overrides (more similar to builtin python syntax highlighting)
				-- treesitter selectors can be overridden per language using @selector.language
				["@variable"] = { link = "GruvboxFg0" },
				["@punctuation.bracket"] = { link = "GruvboxFg0" },
				["@punctuation.delimiter"] = { link = "GruvboxFg0" },
				["@keyword.import"] = { link = "GruvboxBlue" },
				["@function"] = { link = "GruvboxAqua" },
				["@function.method"] = { link = "GruvboxAqua" },
				["@function.method"] = { link = "GruvboxAqua" },
				["@attribute.builtin"] = { link = "GruvboxGreenBold" },
				["@attribute"] = { link = "GruvboxGreenBold" },
				["@operator"] = { link = "GruvboxRed" },
				["@variable.member"] = { link = "GruvboxFg0" },
				["@variable.parameter"] = { link = "GruvboxFg0" },
				["@function.call"] = { link = "GruvboxPurple" },
				["@function.method.call"] = { link = "GruvboxPurple" },
				-- rainbow delimiters colors
				RainbowDelimiterRed    = { fg = "#ff4433" },
				RainbowDelimiterYellow = { fg = "#ffff22" },
				RainbowDelimiterBlue   = { fg = "#66f3ff" },
				RainbowDelimiterOrange = { fg = "#ffaa00" },
				RainbowDelimiterGreen  = { fg = "#99ff44" },
				RainbowDelimiterViolet = { fg = "#aa00ff" },
				RainbowDelimiterCyan   = { fg = "#22ddff" },
				-- TODO italic string start / end
				--["@string_start"] = { italic = true },
				--["@string_end"] = { italic = true },
			},
		})

		-- set colorscheme
		vim.cmd.colorscheme "gruvbox"

		-- fix todo comment highlighting (here instead of theme overrides since this replaces the bg w/ default)
		vim.api.nvim_set_hl(0, "Todo", { fg = "#ffffff", bold = true })
	end,
}