mirror of
https://github.com/maxmx03/solarized.nvim.git
synced 2026-09-10 07:26:26 -04:00
- updated README.md to reflect new option Defaults to true. If enabled is false remove all styles. Allows for easier modification for users who do not want any styles with the colorscheme.
54 lines
1.4 KiB
Lua
54 lines
1.4 KiB
Lua
---@class solarized
|
|
---@field config? solarized.config
|
|
---@field setup? fun(config: solarized.config)
|
|
---@field load? fun()
|
|
|
|
---@type solarized
|
|
local M = {}
|
|
|
|
M.config = require 'solarized.config'
|
|
|
|
M.setup = function(config)
|
|
M.config = vim.tbl_deep_extend('force', M.config, config)
|
|
|
|
if M.config.styles.enabled == false then
|
|
M.config.styles = {
|
|
types = { italic = false, bold = false },
|
|
functions = { italic = false, bold = false },
|
|
parameters = { italic = false, bold = false },
|
|
comments = { italic = false, bold = false },
|
|
strings = { italic = false, bold = false },
|
|
keywords = { italic = false, bold = false },
|
|
variables = { italic = false, bold = false },
|
|
constants = { italic = false, bold = false },
|
|
}
|
|
end
|
|
end
|
|
|
|
M.load = function()
|
|
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'
|
|
local highlights = {}
|
|
local colors = {}
|
|
if vim.o.background == 'dark' then
|
|
highlights = require 'solarized.highlights'
|
|
local palette = require 'solarized.palette'
|
|
colors = palette[M.config.palette]
|
|
else
|
|
highlights = require 'solarized.highlights.solarized-light'
|
|
local palette = require 'solarized.palette.solarized-light'
|
|
colors = palette[M.config.palette]
|
|
end
|
|
|
|
highlights.set_highlight(colors, M.config)
|
|
end
|
|
|
|
return M
|