mirror of
https://github.com/maxmx03/solarized.nvim.git
synced 2026-09-10 07:26:26 -04:00
rename theme property, new property style
This commit is contained in:
parent
1fb558688c
commit
2d6691fef4
14
README.md
14
README.md
|
|
@ -34,6 +34,8 @@ Plug 'maxmx03/solarized.nvim'
|
|||
```
|
||||
|
||||
## How to Config
|
||||
|
||||
example
|
||||
```lua
|
||||
local success, solarized = pcall(require, 'solarized')
|
||||
|
||||
|
|
@ -42,9 +44,15 @@ if not success then
|
|||
end
|
||||
|
||||
local default_config = {
|
||||
transparent = false,
|
||||
color_mode = 'dark',
|
||||
transparent = false, -- true/false
|
||||
mode = 'dark', -- light/dark
|
||||
style = 'default' -- default/vscode
|
||||
}
|
||||
|
||||
solarized:setup(default_config)
|
||||
local your_config = {
|
||||
mode = 'dark',
|
||||
style = 'vscode',
|
||||
}
|
||||
|
||||
solarized:setup(your_config or default_config)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
lua << EOF
|
||||
local solarized = require("solarized")
|
||||
local solarized = require('solarized')
|
||||
|
||||
solarized:setup({})
|
||||
solarized:setup()
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
local theme = require 'solarized.theme'
|
||||
local colors = theme:get_colors()
|
||||
|
||||
local highlights = {
|
||||
--{{{ BASE - VIM LOOK
|
||||
local highlights = {}
|
||||
|
||||
--{{{ BASE - VIM LOOK
|
||||
highlights.base = {
|
||||
Comment = { fg = colors.comment, italic = true },
|
||||
ColorColumn = { bg = colors.bg_alt },
|
||||
Conceal = { fg = colors.blue },
|
||||
|
|
@ -141,9 +143,11 @@ local highlights = {
|
|||
Error = { fg = colors.danger, bg = colors.bg_alt, bold = true },
|
||||
ErrorMsg = { fg = colors.danger, reverse = true },
|
||||
WarningMsg = { fg = colors.warning, bold = true },
|
||||
--}}}
|
||||
}
|
||||
--}}}
|
||||
|
||||
--{{{ TREESITTER - VSCODE LOOK
|
||||
--{{{ TREESITTER - VSCODE LOOK
|
||||
highlights.treesitter = {
|
||||
TSVariable = { fg = colors.blue },
|
||||
TSNumber = { fg = colors.magenta },
|
||||
TSInclude = { fg = colors.green },
|
||||
|
|
@ -164,9 +168,12 @@ local highlights = {
|
|||
TSTypeBuiltin = { fg = colors.green },
|
||||
TSField = { fg = colors.green },
|
||||
TSProperty = { fg = colors.green },
|
||||
-- --}}}
|
||||
}
|
||||
--}}}
|
||||
|
||||
--{{{ NVIM-TREE
|
||||
--{{{ NVIM-TREE
|
||||
highlights.nvim_tree = {
|
||||
NvimTreeNormalNC = { link = 'NormalNC' },
|
||||
NvimTreeVertSplit = { fg = colors.bg },
|
||||
|
||||
NvimTreeFolderIcon = { fg = colors.blue },
|
||||
|
|
@ -181,37 +188,45 @@ local highlights = {
|
|||
NvimTreeGitStaged = { fg = colors.added },
|
||||
NvimTreeGitNew = { fg = colors.added },
|
||||
NvimTreeGitDeleted = { fg = colors.deleted },
|
||||
--}}}
|
||||
}
|
||||
--}}}
|
||||
|
||||
-- {{{ NEO-TREE
|
||||
-- {{{ NEO-TREE
|
||||
highlights.neo_tree = {
|
||||
NeoTreeDirectoryName = { fg = colors.fg },
|
||||
NeoTreeDirectoryIcon = { fg = colors.blue },
|
||||
NeoTreeRootName = { fg = colors.blue },
|
||||
-- }}}
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ TELESCOPE
|
||||
--{{{ TELESCOPE
|
||||
highlights.telescope = {
|
||||
TelescopePreviewTitle = { fg = colors.bg, bg = colors.blue },
|
||||
TelescopeResultsTitle = { fg = colors.bg, bg = colors.blue },
|
||||
TelescopePromptTitle = { fg = colors.bg, bg = colors.blue },
|
||||
|
||||
TelescopeSelection = { fg = colors.yellow },
|
||||
TelescopeMatching = { fg = colors.yellow, reverse = true },
|
||||
-- }}}
|
||||
}
|
||||
--}}}
|
||||
|
||||
-- {{{ DASHBOARD
|
||||
--{{{ DASHBOARD
|
||||
highlights.dashboard = {
|
||||
DashboardHeader = { fg = colors.primary },
|
||||
DashboardCenter = { fg = colors.blue },
|
||||
DashboardFooter = { fg = colors.content },
|
||||
-- }}}
|
||||
}
|
||||
--}}}
|
||||
|
||||
-- {{{ GIT
|
||||
--{{{ GIT
|
||||
highlights.git = {
|
||||
SignAdd = { fg = colors.added },
|
||||
SignChange = { fg = colors.changed },
|
||||
SignDelete = { fg = colors.deleted },
|
||||
GitSignsAdd = { fg = colors.added },
|
||||
GitSignsChange = { fg = colors.changed },
|
||||
GitSignsDelete = { fg = colors.deleted },
|
||||
-- }}}
|
||||
}
|
||||
--}}}
|
||||
|
||||
return highlights
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
-- {{{ solarized colors
|
||||
-- {{{ dark
|
||||
-- base03 #002b36 background
|
||||
-- bas03 #002b36 background
|
||||
-- base02 #073642 background highlights
|
||||
-- base01 #586e75 comments / secondary content
|
||||
-- base0 #839496 foreground / body text
|
||||
|
|
@ -97,15 +97,19 @@ theme.palette = {
|
|||
},
|
||||
}
|
||||
-- }}}
|
||||
theme.color_mode = 'dark'
|
||||
theme.mode = 'dark'
|
||||
theme.transparent = false
|
||||
theme.style = 'default'
|
||||
|
||||
--{{{ get colors with the correct theme
|
||||
function theme:get_colors()
|
||||
local colors = self.palette[self.color_mode]
|
||||
local colors = self.palette[self.mode]
|
||||
|
||||
return colors
|
||||
end
|
||||
--}}}
|
||||
|
||||
--{{{ verify if is transparent
|
||||
function theme:is_transparent(color)
|
||||
if self.transparent then
|
||||
return 'NONE'
|
||||
|
|
@ -113,8 +117,11 @@ function theme:is_transparent(color)
|
|||
|
||||
return color
|
||||
end
|
||||
--}}}
|
||||
|
||||
--{{{ solarized:setup
|
||||
function theme:setup(config)
|
||||
--{{{ hl clear, reset syntax, colors_name
|
||||
if vim.g.colors_name then
|
||||
vim.cmd 'hi clear'
|
||||
end
|
||||
|
|
@ -124,18 +131,35 @@ function theme:setup(config)
|
|||
end
|
||||
|
||||
vim.g.colors_name = 'solarized'
|
||||
--}}}
|
||||
|
||||
--{{{ default config or user config
|
||||
config = config or {}
|
||||
|
||||
if not vim.tbl_isempty(config) then
|
||||
self.color_mode = config.color_mode or self.color_mode
|
||||
self.mode = config.mode or self.mode
|
||||
self.transparent = config.transparent or self.transparent
|
||||
self.style = config.style or self.style
|
||||
end
|
||||
|
||||
vim.o.background = self.color_mode
|
||||
vim.o.background = self.mode
|
||||
--}}}
|
||||
|
||||
--{{{ load highlights
|
||||
local highlights = require 'solarized.highlights'
|
||||
local utils = require 'solarized.utils'
|
||||
|
||||
utils.set_highlights(highlights)
|
||||
utils.set_highlights(highlights.base)
|
||||
if self.style == 'vscode' then
|
||||
utils.set_highlights(highlights.treesitter)
|
||||
end
|
||||
utils.set_highlights(highlights.nvim_tree)
|
||||
utils.set_highlights(highlights.neo_tree)
|
||||
utils.set_highlights(highlights.telescope)
|
||||
utils.set_highlights(highlights.dashboard)
|
||||
utils.set_highlights(highlights.git)
|
||||
--}}}
|
||||
end
|
||||
--}}}
|
||||
|
||||
return theme
|
||||
|
|
|
|||
Loading…
Reference in a new issue