mirror of
https://github.com/maxmx03/solarized.nvim.git
synced 2026-09-10 07:26:26 -04:00
solarized rework
This commit is contained in:
parent
3d5fd35016
commit
f25a1be581
|
|
@ -1,3 +1,4 @@
|
|||
require 'solarized.utils.events'
|
||||
local solarized = require 'solarized'
|
||||
|
||||
solarized.setup(_G.user_config)
|
||||
solarized.setup(vim.g.user_config)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
local solarized = require 'solarized'
|
||||
local chromatic = require 'solarized.utils.chromatic'
|
||||
local colors = solarized.colors
|
||||
local colortool = require 'solarized.src.colortool'
|
||||
local darken = colortool.darken
|
||||
local darken = chromatic.darken
|
||||
|
||||
local M = {
|
||||
normal = {
|
||||
|
|
|
|||
45
lua/solarized/colors/dark.lua
Normal file
45
lua/solarized/colors/dark.lua
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
local dark = {
|
||||
bg = '#002636',
|
||||
bg_alt = '#073642',
|
||||
bg_invert = '#fdf6e3',
|
||||
bg_alt_invert = '#eee8d5',
|
||||
|
||||
-- CONTENT TONES
|
||||
fg = '#839496',
|
||||
content = '#93a1a1',
|
||||
comment = '#586e75',
|
||||
primary = '#268bd2',
|
||||
secondary = '#586e75',
|
||||
|
||||
-- CONTENT INVERT TONES
|
||||
fg_invert = '#657b83',
|
||||
content_invert = '#586e75',
|
||||
comment_invert = '#93a1a1',
|
||||
primary_invert = '#d33682',
|
||||
secondary_invert = '#93a1a1',
|
||||
|
||||
-- ACCENT COLORS
|
||||
blue = '#268bd2',
|
||||
violet = '#6c71c4',
|
||||
magenta = '#d33682',
|
||||
red = '#dc3545',
|
||||
orange = '#cb4b16',
|
||||
yellow = '#b58900',
|
||||
green = '#859900',
|
||||
cyan = '#2aa198',
|
||||
|
||||
-- DIAGNOSTICS TONES
|
||||
error = '#dc322f',
|
||||
info = '#268bd2',
|
||||
hint = '#859900',
|
||||
warning = '#b58900',
|
||||
other = '#93a1a1',
|
||||
|
||||
-- GIT TONES
|
||||
added = '#859900',
|
||||
changed = '#b58900',
|
||||
removed = '#dc322f',
|
||||
deleted = '#dc322f',
|
||||
}
|
||||
|
||||
return dark
|
||||
41
lua/solarized/colors/light.lua
Normal file
41
lua/solarized/colors/light.lua
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
local light = {
|
||||
-- BACKGROUND TONES
|
||||
bg = '#fdf6e3',
|
||||
bg_alt = '#eee8d5',
|
||||
|
||||
-- BACKGROUND DARK TONES
|
||||
bg_invert = '#002636',
|
||||
bg_alt_invert = '#073642',
|
||||
|
||||
-- CONTENT TONES
|
||||
fg = '#657b83',
|
||||
content = '#586e75',
|
||||
comment = '#93a1a1',
|
||||
primary = '#d33682',
|
||||
secondary = '#93a1a1',
|
||||
|
||||
-- ACCENT COLORS
|
||||
blue = '#268bd2',
|
||||
violet = '#6c71c4',
|
||||
magenta = '#d33682',
|
||||
red = '#dc3545',
|
||||
orange = '#cb4b16',
|
||||
yellow = '#b58900',
|
||||
green = '#859900',
|
||||
cyan = '#2aa198',
|
||||
|
||||
-- DIAGNOSTICS TONES
|
||||
error = '#dc322f',
|
||||
info = '#268bd2',
|
||||
hint = '#859900',
|
||||
warning = '#b58900',
|
||||
other = '#93a1a1',
|
||||
|
||||
-- GIT TONES
|
||||
added = '#859900',
|
||||
changed = '#b58900',
|
||||
removed = '#dc322f',
|
||||
deleted = '#dc322f',
|
||||
}
|
||||
|
||||
return light
|
||||
63
lua/solarized/colorscheme.lua
Normal file
63
lua/solarized/colorscheme.lua
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
local chromatic = require 'solarized.utils.chromatic'
|
||||
|
||||
local Colorscheme = {}
|
||||
|
||||
Colorscheme.colors = {}
|
||||
Colorscheme.highlights = {}
|
||||
Colorscheme.config = {
|
||||
theme = 'vim',
|
||||
transparent = false,
|
||||
}
|
||||
|
||||
function Colorscheme:new()
|
||||
local t = {}
|
||||
|
||||
setmetatable(t, self)
|
||||
self.__index = self
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
function Colorscheme:override_colors(c)
|
||||
if c and type(c) == 'function' then
|
||||
local colors = c(self.colors, chromatic.darken, chromatic.lighten, chromatic.blend)
|
||||
|
||||
self.colors = vim.tbl_extend('force', self.colors, colors)
|
||||
elseif c and type(c) == 'table' then
|
||||
self.colors = vim.tbl_extend('force', self.colors, c)
|
||||
end
|
||||
end
|
||||
|
||||
function Colorscheme:override_hl(hl)
|
||||
if hl and type(hl) == 'function' then
|
||||
local highlights = hl(self.colors, chromatic.darken, chromatic.lighten, chromatic.blend)
|
||||
|
||||
self.highlights = vim.tbl_extend('force', self.highlights, highlights)
|
||||
elseif hl and type(hl) == 'table' then
|
||||
self.highlights = vim.tbl_extend('force', self.highlights, hl)
|
||||
end
|
||||
end
|
||||
|
||||
function Colorscheme:override_config(config)
|
||||
if config and type(config) == 'table' then
|
||||
self.config = vim.tbl_extend('force', self.config, config)
|
||||
end
|
||||
end
|
||||
|
||||
function Colorscheme:is_transparent(color)
|
||||
if self.config.transparent then
|
||||
return 'NONE'
|
||||
end
|
||||
|
||||
return color
|
||||
end
|
||||
|
||||
function Colorscheme:is_not_transparent(color)
|
||||
if not self.config.transparent then
|
||||
return 'NONE'
|
||||
end
|
||||
|
||||
return color
|
||||
end
|
||||
|
||||
return Colorscheme
|
||||
|
|
@ -1,62 +1,18 @@
|
|||
local solarized = require 'solarized.src.colorscheme'
|
||||
local utils = require 'solarized.src.utils'
|
||||
local colors = require 'solarized.src.colors'
|
||||
local colortool = require 'solarized.src.colortool'
|
||||
local darken = colortool.darken
|
||||
local blend = colortool.blend
|
||||
local solarized = require 'solarized.colorscheme'
|
||||
local utils = require 'solarized.utils'
|
||||
local chromatic = require 'solarized.utils.chromatic'
|
||||
|
||||
function solarized.setup(user_config)
|
||||
_G.user_config = user_config
|
||||
vim.g.user_config = user_config or {}
|
||||
|
||||
if vim.g.colors_name then
|
||||
vim.cmd 'hi clear'
|
||||
end
|
||||
|
||||
if vim.fn.exists 'syntax_on' then
|
||||
vim.cmd 'syntax reset'
|
||||
end
|
||||
|
||||
vim.g.colors_name = 'solarized'
|
||||
|
||||
-- user config
|
||||
solarized.config = vim.tbl_extend('force', solarized.config, user_config or {})
|
||||
|
||||
-- colors: dark or light
|
||||
solarized.colors = colors[vim.o.background]
|
||||
vim.cmd(string.format('set background=%s', vim.o.background))
|
||||
|
||||
-- -- override or add colors
|
||||
if user_config and type(user_config.colors) == 'table' then
|
||||
solarized.colors = vim.tbl_extend('force', solarized.colors, user_config.colors)
|
||||
elseif user_config and type(user_config.colors) == 'function' then
|
||||
solarized.colors = vim.tbl_extend('force', solarized.colors, user_config.colors(solarized.colors, darken, blend))
|
||||
end
|
||||
|
||||
require('solarized.src.themes.' .. solarized.config.theme)(solarized)
|
||||
|
||||
if user_config and type(user_config.highlights) == 'table' then
|
||||
solarized.highlights = vim.tbl_extend('force', solarized.highlights, user_config.highlights)
|
||||
elseif user_config and type(user_config.highlights) == 'function' then
|
||||
solarized.highlights =
|
||||
vim.tbl_extend('force', solarized.highlights, user_config.highlights(solarized.colors, darken, blend))
|
||||
end
|
||||
|
||||
utils.set_highlights(solarized.highlights)
|
||||
utils.load_colorscheme()
|
||||
solarized.colors = require(string.format('solarized.colors.%s', vim.o.background))
|
||||
solarized:override_config(user_config)
|
||||
solarized.override_colors(user_config.colors)
|
||||
local hl_theme = require(string.format('solarized.themes.%s', solarized.config.theme))
|
||||
solarized.highlights = hl_theme(solarized, chromatic)
|
||||
solarized:override_hl(user_config.highlights)
|
||||
utils.apply_colorscheme_highlights(solarized.highlights)
|
||||
end
|
||||
|
||||
local solarized_colors = { 'solarized', 'solarized8', 'solarized16' }
|
||||
|
||||
local function on_colorscheme_change()
|
||||
if vim.tbl_contains(solarized_colors, vim.g.colors_name) then
|
||||
-- Call your Solarized setup function here
|
||||
vim.api.nvim_command "lua require('solarized').setup(_G.user_config)"
|
||||
end
|
||||
end
|
||||
|
||||
-- Create the autocmd to listen for the colorscheme event
|
||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||
pattern = '*',
|
||||
callback = on_colorscheme_change,
|
||||
})
|
||||
|
||||
return solarized
|
||||
|
|
|
|||
|
|
@ -1,121 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
-- Dark
|
||||
-- base03 #002b36 background
|
||||
-- base02 #073642 background highlights
|
||||
-- base01 #586e75 comments / secondary content
|
||||
-- base0 #839496 foreground / body text
|
||||
-- base1 #93a1a1 foreground / emphasized content
|
||||
|
||||
-- Light
|
||||
-- base3 #fdf6e3 background
|
||||
-- base2 #eee8d5 background highlights
|
||||
-- base1 #93a1a1 comments / secondary content
|
||||
-- base00 #657b83 foreground / body text
|
||||
-- base01 #586e75 foreground / emphasized content
|
||||
|
||||
-- default
|
||||
-- yellow #b58900
|
||||
-- orange #cb4b16
|
||||
-- red #dc322f
|
||||
-- magenta #d33682
|
||||
-- violet #6c71c4
|
||||
-- blue #268bd2
|
||||
-- cyan #2aa198
|
||||
-- green #859900
|
||||
|
||||
M.dark = {
|
||||
-- BACKGROUND TONES
|
||||
bg = '#002636',
|
||||
bg_alt = '#073642',
|
||||
|
||||
-- BACKGROUND INVERT TONES
|
||||
bg_invert = '#fdf6e3',
|
||||
bg_alt_invert = '#eee8d5',
|
||||
|
||||
-- CONTENT TONES
|
||||
fg = '#839496',
|
||||
content = '#93a1a1',
|
||||
comment = '#586e75',
|
||||
primary = '#268bd2',
|
||||
secondary = '#586e75',
|
||||
|
||||
-- CONTENT INVERT TONES
|
||||
fg_invert = '#657b83',
|
||||
content_invert = '#586e75',
|
||||
comment_invert = '#93a1a1',
|
||||
primary_invert = '#d33682',
|
||||
secondary_invert = '#93a1a1',
|
||||
|
||||
-- ACCENT COLORS
|
||||
blue = '#268bd2',
|
||||
violet = '#6c71c4',
|
||||
magenta = '#d33682',
|
||||
red = '#dc3545',
|
||||
orange = '#cb4b16',
|
||||
yellow = '#b58900',
|
||||
green = '#859900',
|
||||
cyan = '#2aa198',
|
||||
|
||||
-- DIAGNOSTICS TONES
|
||||
error = '#dc322f',
|
||||
info = '#268bd2',
|
||||
hint = '#859900',
|
||||
warning = '#b58900',
|
||||
other = '#93a1a1',
|
||||
|
||||
-- GIT TONES
|
||||
added = '#859900',
|
||||
changed = '#b58900',
|
||||
removed = '#dc322f',
|
||||
deleted = '#dc322f',
|
||||
}
|
||||
|
||||
M.light = {
|
||||
-- BACKGROUND TONES
|
||||
bg = '#fdf6e3',
|
||||
bg_alt = '#eee8d5',
|
||||
|
||||
-- BACKGROUND DARK TONES
|
||||
bg_invert = '#002636',
|
||||
bg_alt_invert = '#073642',
|
||||
|
||||
-- CONTENT TONES
|
||||
fg = '#657b83',
|
||||
content = '#586e75',
|
||||
comment = '#93a1a1',
|
||||
primary = '#d33682',
|
||||
secondary = '#93a1a1',
|
||||
|
||||
-- CONTENT INVERT TONES
|
||||
fg_invert = '#839496',
|
||||
content_invert = '#93a1a1',
|
||||
comment_invert = '#586e75',
|
||||
primary_invert = '#268bd2',
|
||||
secondary_invert = '#586e75',
|
||||
|
||||
-- ACCENT COLORS
|
||||
blue = '#268bd2',
|
||||
violet = '#6c71c4',
|
||||
magenta = '#d33682',
|
||||
red = '#dc3545',
|
||||
orange = '#cb4b16',
|
||||
yellow = '#b58900',
|
||||
green = '#859900',
|
||||
cyan = '#2aa198',
|
||||
|
||||
-- DIAGNOSTICS TONES
|
||||
error = '#dc322f',
|
||||
info = '#268bd2',
|
||||
hint = '#859900',
|
||||
warning = '#b58900',
|
||||
other = '#93a1a1',
|
||||
|
||||
-- GIT TONES
|
||||
added = '#859900',
|
||||
changed = '#b58900',
|
||||
removed = '#dc322f',
|
||||
deleted = '#dc322f',
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.colors = {}
|
||||
M.config = {
|
||||
mode = 'dark',
|
||||
theme = 'vim',
|
||||
transparent = false,
|
||||
}
|
||||
|
||||
function M:new()
|
||||
local t = {}
|
||||
|
||||
self.__index = self
|
||||
setmetatable(t, self)
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
function M:is_transparent(color)
|
||||
if self.config.transparent then
|
||||
return 'NONE'
|
||||
end
|
||||
|
||||
return color
|
||||
end
|
||||
|
||||
function M:is_not_transparent(color)
|
||||
if not self.config.transparent then
|
||||
return 'NONE'
|
||||
end
|
||||
|
||||
return color
|
||||
end
|
||||
|
||||
local solarized = M:new()
|
||||
|
||||
return solarized
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
local function neovim(solarized)
|
||||
local colortool = require 'solarized.src.colortool'
|
||||
local function neovim(solarized, chromatic)
|
||||
local colors = solarized.colors
|
||||
|
||||
local darken = colortool.darken
|
||||
local blend = colortool.blend
|
||||
local darken = chromatic.darken
|
||||
local blend = chromatic.blend
|
||||
|
||||
solarized.highlights = {
|
||||
return {
|
||||
-- Editor
|
||||
Normal = { fg = colors.fg, bg = solarized:is_transparent(colors.bg) },
|
||||
NormalNC = { fg = colors.content, bg = solarized:is_transparent(colors.bg_alt) },
|
||||
|
|
@ -407,7 +406,7 @@ local function neovim(solarized)
|
|||
-- NVIM-TREE
|
||||
NvimTreeNormalNC = { link = 'NormalNC' },
|
||||
NvimTreeVertSplit = { fg = colors.bg },
|
||||
NvimTreeFolderIcon = { fg = colors.blue },
|
||||
NvimTreeFolderIcon = { fg = colors.orange },
|
||||
NvimTreeFolderName = { fg = colors.fg },
|
||||
NvimTreeOpenedFolderName = { fg = colors.blue },
|
||||
NvimTreeRootFolder = { fg = colors.blue },
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
function vim(solarized)
|
||||
local colors = solarized
|
||||
|
||||
solarized.highlights = {
|
||||
return {
|
||||
-- Editor
|
||||
Normal = { fg = colors.fg, bg = solarized:is_transparent(colors.bg) },
|
||||
NormalNC = { fg = colors.content, bg = solarized:is_transparent(colors.bg_alt) },
|
||||
|
|
@ -27,7 +27,7 @@ function vim(solarized)
|
|||
MsgSeparator = { fg = colors.content, bg = colors.bg_alt },
|
||||
MoreMsg = { fg = colors.blue },
|
||||
WarningMsg = { fg = colors.warning, bold = true },
|
||||
ErrorMsg = { fg = colors.danger, reverse = true },
|
||||
ErrorMsg = { fg = colors.error, reverse = true },
|
||||
MatchParen = { fg = colors.red, bg = colors.content, bold = true },
|
||||
TabLine = { fg = colors.fg, bg = colors.bg_alt, sp = colors.fg },
|
||||
TabLineSel = { fg = colors.secondary, bg = colors.bg_alt_invert, sp = colors.fg, reverse = true },
|
||||
|
|
@ -44,7 +44,7 @@ function vim(solarized)
|
|||
VertSplit = { fg = colors.fg, bg = colors.bg_alt },
|
||||
WinSeparator = { fg = colors.fg, bold = true },
|
||||
FloatBorder = { fg = colors.fg, bg = colors.bg_alt, sp = colors.fg },
|
||||
SpellBad = { sp = colors.danger, undercurl = true },
|
||||
SpellBad = { sp = colors.error, undercurl = true },
|
||||
SpellCap = { sp = colors.violet, undercurl = true },
|
||||
SpellLocal = { sp = colors.warning, undercurl = true },
|
||||
SpellRare = { sp = colors.cyan, undercurl = true },
|
||||
|
|
@ -137,7 +137,7 @@ function vim(solarized)
|
|||
Italic = { italic = true },
|
||||
Ignore = { fg = colors.cyan, bg = colors.bg_alt, bold = true },
|
||||
Todo = { fg = colors.red, bg = colors.bg_alt, bold = true },
|
||||
Error = { fg = colors.danger, bg = colors.bg_alt, bold = true },
|
||||
Error = { fg = colors.error, bg = colors.bg_alt, bold = true },
|
||||
|
||||
-- Git
|
||||
SignAdd = { fg = colors.added },
|
||||
|
|
@ -156,7 +156,7 @@ function vim(solarized)
|
|||
-- Lsp
|
||||
DiagnosticHint = { fg = colors.hint },
|
||||
DiagnosticInfo = { fg = colors.info },
|
||||
DiagnosticError = { fg = colors.danger },
|
||||
DiagnosticError = { fg = colors.error },
|
||||
DiagnosticOther = { fg = colors.other },
|
||||
DiagnosticSignHint = { link = 'DiagnosticHint' },
|
||||
DiagnosticSignInfo = { link = 'DiagnosticInfo' },
|
||||
|
|
@ -171,12 +171,12 @@ function vim(solarized)
|
|||
DiagnosticUnderlineHint = { sp = colors.hint, undercurl = true },
|
||||
DiagnosticUnderlineInfo = { sp = colors.info, undercurl = true },
|
||||
DiagnosticUnderlineWarn = { sp = colors.warning, undercurl = true },
|
||||
DiagnosticUnderlineError = { sp = colors.danger, undercurl = true },
|
||||
DiagnosticUnderlineError = { sp = colors.error, undercurl = true },
|
||||
DiagnosticSignInformation = { link = 'DiagnosticInfo' },
|
||||
DiagnosticVirtualTextHint = { fg = colors.hint, bg = colors.bg_alt },
|
||||
DiagnosticVirtualTextInfo = { fg = colors.info, bg = colors.bg_alt },
|
||||
DiagnosticVirtualTextWarn = { fg = colors.warning, bg = colors.bg_alt },
|
||||
DiagnosticVirtualTextError = { fg = colors.danger, bg = colors.bg_alt },
|
||||
DiagnosticVirtualTextError = { fg = colors.error, bg = colors.bg_alt },
|
||||
LspDiagnosticsError = { link = 'DiagnosticError' },
|
||||
LspDiagnosticsWarning = { link = 'DiagnosticWarn' },
|
||||
LspDiagnosticsInfo = { link = 'DiagnosticInfo' },
|
||||
|
|
@ -285,7 +285,7 @@ function vim(solarized)
|
|||
-- NvimTree
|
||||
NvimTreeNormalNC = { link = 'NormalNC' },
|
||||
NvimTreeVertSplit = { fg = colors.bg },
|
||||
NvimTreeFolderIcon = { fg = colors.blue },
|
||||
NvimTreeFolderIcon = { fg = colors.red },
|
||||
NvimTreeFolderName = { fg = colors.fg },
|
||||
NvimTreeOpenedFolderName = { fg = colors.blue },
|
||||
NvimTreeRootFolder = { fg = colors.blue },
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
local function vscode(solarized)
|
||||
local colortool = require 'solarized.src.colortool'
|
||||
local function vscode(solarized, chromatic)
|
||||
local colors = solarized.colors
|
||||
local darken = colortool.darken
|
||||
local blend = colortool.blend
|
||||
local darken = chromatic.darken
|
||||
local blend = chromatic.blend
|
||||
|
||||
solarized.highlights = {
|
||||
return {
|
||||
-- Editor
|
||||
Normal = { fg = colors.fg, bg = solarized:is_transparent(colors.bg) },
|
||||
NormalNC = { fg = colors.content, bg = solarized:is_transparent(colors.bg_alt) },
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
---@diagnostic disable: cast-local-type
|
||||
local M = {}
|
||||
local chromatic = {}
|
||||
|
||||
function M.hex_to_rgb(hex)
|
||||
function chromatic.hex_to_rgb(hex)
|
||||
-- Remove the "#" character if present
|
||||
hex = hex:gsub('#', '')
|
||||
|
||||
|
|
@ -31,7 +30,7 @@ local function rgb_to_hex(red, green, blue)
|
|||
return string.format('#%02X%02X%02X', red, green, blue)
|
||||
end
|
||||
|
||||
function M.darken(color, percent)
|
||||
function chromatic.darken(color, percent)
|
||||
local r = tonumber(color:sub(2, 3), 16)
|
||||
local g = tonumber(color:sub(4, 5), 16)
|
||||
local b = tonumber(color:sub(6, 7), 16)
|
||||
|
|
@ -43,7 +42,7 @@ function M.darken(color, percent)
|
|||
return string.format('#%02X%02X%02X', r, g, b)
|
||||
end
|
||||
|
||||
function M.lighten(color, percent)
|
||||
function chromatic.lighten(color, percent)
|
||||
local r = tonumber(color:sub(2, 3), 16)
|
||||
local g = tonumber(color:sub(4, 5), 16)
|
||||
local b = tonumber(color:sub(6, 7), 16)
|
||||
|
|
@ -55,7 +54,7 @@ function M.lighten(color, percent)
|
|||
return string.format('#%02X%02X%02X', r, g, b)
|
||||
end
|
||||
|
||||
function M.blend(hex_fg, hex_bg, alpha)
|
||||
function chromatic.blend(hex_fg, hex_bg, alpha)
|
||||
local rgb_bg = hex_to_rgb(hex_bg)
|
||||
local rgb_fg = hex_to_rgb(hex_fg)
|
||||
local min = math.min
|
||||
|
|
@ -71,4 +70,4 @@ function M.blend(hex_fg, hex_bg, alpha)
|
|||
return rgb_to_hex(blend_channel(1), blend_channel(2), blend_channel(3))
|
||||
end
|
||||
|
||||
return M
|
||||
return chromatic
|
||||
10
lua/solarized/utils/events.lua
Normal file
10
lua/solarized/utils/events.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
local function onColorschemeChange()
|
||||
if vim.g.colors_name == 'solarized' then
|
||||
vim.api.nvim_command "lua require('solarized').setup(vim.g.user_config)"
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||
pattern = '*',
|
||||
callback = onColorschemeChange,
|
||||
})
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
local M = {}
|
||||
local utils = {}
|
||||
|
||||
function M.set_highlights(highlight_groups)
|
||||
function utils.apply_colorscheme_highlights(highlight_groups)
|
||||
for group_name, group in pairs(highlight_groups) do
|
||||
if type(group) == 'table' then
|
||||
local val = {}
|
||||
|
|
@ -20,4 +20,17 @@ function M.set_highlights(highlight_groups)
|
|||
end
|
||||
end
|
||||
|
||||
return M
|
||||
function utils.load_colorscheme()
|
||||
if vim.g.colors_name then
|
||||
vim.cmd 'hi clear'
|
||||
end
|
||||
|
||||
if vim.fn.exists 'syntax_on' then
|
||||
vim.cmd 'syntax reset'
|
||||
end
|
||||
|
||||
vim.o.termguicolors = true
|
||||
vim.g.colors_name = 'solarized'
|
||||
end
|
||||
|
||||
return utils
|
||||
Loading…
Reference in a new issue