Refactor structure (#43)

* refactor: palette

* refactor: simplify init

* chore!: rename functions

- `rose-pine.functions.select_variant` -> `rose-pine.set`
- `rose-pine.functions.toggle_variant` -> `rose-pine.toggle`

* docs: update options

* chore: update config with shared headings
This commit is contained in:
not 2021-12-03 09:38:34 -06:00 committed by GitHub
commit 62567755fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 280 additions and 319 deletions

View file

@ -1,9 +1,6 @@
lua << EOF
package.loaded['rose-pine'] = nil
package.loaded['rose-pine.functions'] = nil
package.loaded['rose-pine.palette'] = nil
package.loaded['rose-pine.theme'] = nil
package.loaded['rose-pine.util'] = nil
lua package.loaded['rose-pine'] = nil
lua package.loaded['rose-pine.config'] = nil
lua package.loaded['rose-pine.palette'] = nil
lua package.loaded['rose-pine.theme'] = nil
require('rose-pine').set()
EOF
lua require('rose-pine').colorscheme()

49
lua/rose-pine/config.lua Normal file
View file

@ -0,0 +1,49 @@
local palette = require('rose-pine.palette')
local config = {
bold_vert_split = vim.g.rose_pine_bold_verical_split_line or false,
no_background = vim.g.rose_pine_disable_background or false,
no_italics = vim.g.rose_pine_disable_italics or false,
colors = {
punctuation = palette.subtle,
comment = palette.subtle,
hint = palette.iris,
info = palette.foam,
warn = palette.gold,
error = palette.love,
-- TODO: Expose these once matched with syntax and cmp kind
-- variable = '',
-- class = '',
-- interface = '',
-- ['function'] = '',
-- method = '',
---@type string|table<string, string>
headings = {
h1 = palette.foam,
h2 = palette.foam,
h3 = palette.foam,
h4 = palette.foam,
h5 = palette.foam,
h6 = palette.foam,
},
},
}
local colors = vim.g.rose_pine_colors or {}
if type(colors.headings) == 'string' then
colors.headings = {
h1 = colors.headings,
h2 = colors.headings,
h3 = colors.headings,
h4 = colors.headings,
h5 = colors.headings,
h6 = colors.headings,
}
end
config.colors = vim.tbl_deep_extend('force', config.colors, colors)
return config

View file

@ -1,35 +0,0 @@
local select_variant = function(variant)
vim.g.rose_pine_variant = variant
local formatted_variant = ''
if variant == 'base' then
formatted_variant = ''
else
formatted_variant = variant:sub(1, 1):upper() .. variant:sub(2)
end
print('Rosé Pine', formatted_variant)
vim.cmd([[colorscheme rose-pine]])
end
local toggle_variant = function(variants)
local options = variants or { 'base', 'moon', 'dawn' }
local index = {}
for k, v in pairs(options) do
index[v] = k
end
if vim.g.rose_pine_variant_switch == nil then
-- Ensure theme toggles from correct position
vim.g.rose_pine_variant_switch = index[vim.g.rose_pine_variant] or 0
end
vim.g.rose_pine_variant_switch = (
vim.g.rose_pine_variant_switch % table.getn(options)
) + 1
select_variant(options[vim.g.rose_pine_variant_switch])
end
return {
select_variant = select_variant,
toggle_variant = toggle_variant,
}

View file

@ -1,9 +1,74 @@
local util = require('rose-pine.util')
local M = {}
function M.set()
util.load()
function M.colorscheme()
if vim.g.colors_name then
vim.cmd('hi clear')
end
vim.opt.termguicolors = true
vim.g.colors_name = 'rose-pine'
-- Match terminal theme if no variant is set
if vim.g.rose_pine_variant == nil and vim.o.background == 'light' then
vim.g.rose_pine_variant = 'dawn'
elseif vim.g.rose_pine_variant == 'dawn' then
vim.o.background = 'light'
end
---@param group string
---@param color table<string, string>
local function highlight(group, color)
local style = color.style and 'gui=' .. color.style or 'gui=NONE'
local fg = color.fg and 'guifg=' .. color.fg or 'guifg=NONE'
local bg = color.bg and 'guibg=' .. color.bg or 'guibg=NONE'
local sp = color.sp and 'guisp=' .. color.sp or ''
local hl = 'highlight '
.. group
.. ' '
.. style
.. ' '
.. fg
.. ' '
.. bg
.. ' '
.. sp
vim.cmd(hl)
if color.link then
vim.cmd('highlight! link ' .. group .. ' ' .. color.link)
end
end
for group, colors in pairs(require('rose-pine.theme')) do
highlight(group, colors)
end
require('rose-pine.galaxyline.theme')
end
function M.set(variant)
vim.g.rose_pine_variant = variant
vim.cmd([[colorscheme rose-pine]])
end
function M.toggle(variants)
variants = variants or { 'main', 'moon', 'dawn' }
local index = {}
for k, v in pairs(variants) do
index[v] = k
end
if vim.g.rose_pine_current_variant == nil then
vim.g.rose_pine_current_variant = index[vim.g.rose_pine_variant] or 0
end
vim.g.rose_pine_current_variant = (
vim.g.rose_pine_current_variant % #variants
) + 1
M.set(variants[vim.g.rose_pine_current_variant])
end
return M

View file

@ -1,48 +1,22 @@
local palette = {
base = '#191724',
surface = '#1f1d2e',
overlay = '#26233a',
inactive = '#555169',
subtle = '#6e6a86',
text = '#e0def4',
love = '#eb6f92',
gold = '#f6c177',
rose = '#ebbcba',
pine = '#31748f',
foam = '#9ccfd8',
iris = '#c4a7e7',
highlight_low = '#21202e',
highlight_med = '#403d52',
highlight_high = '#524f67',
none = 'NONE',
}
if
vim.g.rose_pine_variant == 'dawn'
or vim.g.rose_pine_variant == 'rose-pine-dawn'
then
palette = {
base = '#faf4ed',
surface = '#fffaf3',
overlay = '#f2e9de',
inactive = '#9893a5',
local variants = {
main = {
base = '#191724',
surface = '#1f1d2e',
overlay = '#26233a',
inactive = '#555169',
subtle = '#6e6a86',
text = '#575279',
love = '#b4637a',
gold = '#ea9d34',
rose = '#d7827e',
pine = '#286983',
foam = '#56949f',
iris = '#907aa9',
highlight_low = '#f4ede8',
highlight_med = '#dfdad9',
highlight_high = '#cecacd',
}
elseif
vim.g.rose_pine_variant == 'moon'
or vim.g.rose_pine_variant == 'rose-pine-moon'
then
palette = {
text = '#e0def4',
love = '#eb6f92',
gold = '#f6c177',
rose = '#ebbcba',
pine = '#31748f',
foam = '#9ccfd8',
iris = '#c4a7e7',
highlight_low = '#21202e',
highlight_med = '#403d52',
highlight_high = '#524f67',
},
moon = {
base = '#232136',
surface = '#2a273f',
overlay = '#393552',
@ -58,7 +32,34 @@ then
highlight_low = '#2a283e',
highlight_med = '#44415a',
highlight_high = '#56526e',
}
},
dawn = {
base = '#faf4ed',
surface = '#fffaf3',
overlay = '#f2e9de',
inactive = '#9893a5',
subtle = '#6e6a86',
text = '#575279',
love = '#b4637a',
gold = '#ea9d34',
rose = '#d7827e',
pine = '#286983',
foam = '#56949f',
iris = '#907aa9',
highlight_low = '#f4ede8',
highlight_med = '#dfdad9',
highlight_high = '#cecacd',
},
}
local palette = variants.main
if string.match(vim.g.rose_pine_variant or '', 'moon') then
palette = variants.moon
elseif string.match(vim.g.rose_pine_variant or '', 'dawn') then
palette = variants.dawn
end
vim.tbl_deep_extend('force', palette, { none = 'NONE' })
return palette

View file

@ -1,46 +1,24 @@
local config = require('rose-pine.config')
local p = require('rose-pine.palette')
local user_colors = vim.g.rose_pine_colors or {}
local groups = {
punctuation = user_colors.punctuation or p.subtle,
comment = user_colors.comment or p.subtle,
hint = user_colors.hint or p.iris,
info = user_colors.info or p.foam,
warn = user_colors.warn or p.gold,
error = user_colors.error or p.love,
headings = {
h1 = p.love,
h2 = p.rose,
h3 = p.iris,
h4 = p.pine,
h5 = p.foam,
},
}
groups.headings = vim.tbl_extend(
'force',
groups.headings,
user_colors.headings or {}
)
local theme = {}
-- TODO: Refactor `maybe` logic
local maybe_base = p.base
local maybe_italic = 'italic'
local maybe_bold_vert_split = { fg = p.overlay }
if vim.g.rose_pine_disable_background then
maybe_base = p.none
end
if vim.g.rose_pine_disable_italics then
maybe_italic = nil
end
if vim.g.rose_pine_bold_vertical_split_line then
if config.bold_vert_split then
maybe_bold_vert_split = { fg = p.surface, bg = p.surface }
end
theme.base = {
if config.no_background then
maybe_base = p.none
end
if config.no_italics then
maybe_italic = nil
end
local theme = {
ColorColumn = { bg = p.highlight_high },
Conceal = { bg = p.none },
-- Cursor = {},
@ -66,7 +44,7 @@ theme.base = {
IncSearch = { bg = p.highlight_med },
LineNr = { fg = p.inactive },
MatchParen = { fg = p.text, bg = p.overlay },
-- ModeMsg = {},
ModeMsg = { fg = p.subtle },
MoreMsg = { fg = p.iris },
NonText = { fg = p.inactive },
Normal = { fg = p.text, bg = maybe_base },
@ -102,7 +80,7 @@ theme.base = {
Boolean = { fg = p.gold },
Character = { fg = p.gold },
Comment = {
fg = groups.comment,
fg = config.colors.comment,
style = maybe_italic,
},
Conditional = { fg = p.pine },
@ -141,11 +119,11 @@ theme.base = {
htmlArg = { fg = p.iris },
htmlBold = { fg = p.text, style = 'bold' },
htmlEndTag = { fg = p.subtle },
htmlH1 = { fg = groups.headings.h1, style = 'bold' },
htmlH2 = { fg = groups.headings.h2, style = 'bold' },
htmlH3 = { fg = groups.headings.h3, style = 'bold' },
htmlH4 = { fg = groups.headings.h4, style = 'bold' },
htmlH5 = { fg = groups.headings.h5, style = 'bold' },
htmlH1 = { fg = config.colors.headings.h1, style = 'bold' },
htmlH2 = { fg = config.colors.headings.h2, style = 'bold' },
htmlH3 = { fg = config.colors.headings.h3, style = 'bold' },
htmlH4 = { fg = config.colors.headings.h4, style = 'bold' },
htmlH5 = { fg = config.colors.headings.h5, style = 'bold' },
htmlItalic = { fg = p.text, style = maybe_italic },
htmlLink = { fg = p.text },
htmlTag = { fg = p.subtle },
@ -172,59 +150,54 @@ theme.base = {
-- ^ ^
typescriptParens = { bg = p.none },
DiagnosticHint = { fg = groups.hint },
DiagnosticInfo = { fg = groups.info },
DiagnosticWarn = { fg = groups.warn },
DiagnosticError = { fg = groups.error },
DiagnosticDefaultHint = { fg = groups.hint },
DiagnosticDefaultInfo = { fg = groups.info },
DiagnosticDefaultWarn = { fg = groups.warn },
DiagnosticDefaultError = { fg = groups.error },
DiagnosticFloatingHint = { fg = groups.hint },
DiagnosticFloatingInfo = { fg = groups.info },
DiagnosticFloatingWarn = { fg = groups.warn },
DiagnosticFloatingError = { fg = groups.error },
DiagnosticSignHint = { fg = groups.hint },
DiagnosticSignInfo = { fg = groups.info },
DiagnosticSignWarn = { fg = groups.warn },
DiagnosticSignError = { fg = groups.error },
DiagnosticUnderlineHint = { style = 'undercurl', sp = groups.hint },
DiagnosticUnderlineInfo = { style = 'undercurl', sp = groups.info },
DiagnosticUnderlineWarn = { style = 'undercurl', sp = groups.warn },
DiagnosticUnderlineError = { style = 'undercurl', sp = groups.error },
DiagnosticVirtualTextHint = { fg = groups.hint },
DiagnosticVirtualTextInfo = { fg = groups.info },
DiagnosticVirtualTextWarn = { fg = groups.warn },
DiagnosticVirtualTextError = { fg = groups.error },
DiagnosticHint = { fg = config.colors.hint },
DiagnosticInfo = { fg = config.colors.info },
DiagnosticWarn = { fg = config.colors.warn },
DiagnosticError = { fg = config.colors.error },
DiagnosticDefaultHint = { fg = config.colors.hint },
DiagnosticDefaultInfo = { fg = config.colors.info },
DiagnosticDefaultWarn = { fg = config.colors.warn },
DiagnosticDefaultError = { fg = config.colors.error },
DiagnosticFloatingHint = { fg = config.colors.hint },
DiagnosticFloatingInfo = { fg = config.colors.info },
DiagnosticFloatingWarn = { fg = config.colors.warn },
DiagnosticFloatingError = { fg = config.colors.error },
DiagnosticSignHint = { fg = config.colors.hint },
DiagnosticSignInfo = { fg = config.colors.info },
DiagnosticSignWarn = { fg = config.colors.warn },
DiagnosticSignError = { fg = config.colors.error },
DiagnosticUnderlineHint = { style = 'undercurl', sp = config.colors.hint },
DiagnosticUnderlineInfo = { style = 'undercurl', sp = config.colors.info },
DiagnosticUnderlineWarn = { style = 'undercurl', sp = config.colors.warn },
DiagnosticUnderlineError = {
style = 'undercurl',
sp = config.colors.error,
},
DiagnosticVirtualTextHint = { fg = config.colors.hint },
DiagnosticVirtualTextInfo = { fg = config.colors.info },
DiagnosticVirtualTextWarn = { fg = config.colors.warn },
DiagnosticVirtualTextError = { fg = config.colors.error },
LspReferenceText = { fg = p.rose, bg = p.highlight_med },
LspReferenceRead = { fg = p.rose, bg = p.highlight_med },
LspReferenceWrite = { fg = p.rose, bg = p.highlight_med },
--Lsp color groups for nvim 0.5.x
-- TODO: Deprecate in favour of 0.6.0 groups
LspDiagnosticsSignWarning = { link = 'DiagnosticSignWarn' },
LspDiagnosticsDefaultWarning = { link = 'DiagnosticDefaultWarn' },
LspDiagnosticsFloatingWarning = { link = 'DiagnosticFloatingWarn' },
LspDiagnosticsVirtualTextWarning = { link = 'DiagnosticVirtualTextWarn' },
LspDiagnosticsUnderlineWarning = { link = 'DiagnosticUnderlineWarn' },
LspDiagnosticsSignHint = { link = 'DiagnosticSignHint' },
LspDiagnosticsDefaultHint = { link = 'DiagnosticDefaultHint' },
LspDiagnosticsVirtualTextHint = { link = 'DiagnosticFloatingHint' },
LspDiagnosticsFloatingHint = { link = 'DiagnosticVirtualTextHint' },
LspDiagnosticsUnderlineHint = { link = 'DiagnosticUnderlineHint' },
LspDiagnosticsSignError = { link = 'DiagnosticSignError' },
LspDiagnosticsDefaultError = { link = 'DiagnosticDefaultError' },
LspDiagnosticsFloatingError = { link = 'DiagnosticFloatingError' },
LspDiagnosticsVirtualTextError = { link = 'DiagnosticVirtualTextError' },
LspDiagnosticsUnderlineError = { link = 'DiagnosticUnderlineError' },
LspDiagnosticsSignInformation = { link = 'DiagnosticSignInfo' },
LspDiagnosticsDefaultInformation = { link = 'DiagnosticDefaultInfo' },
LspDiagnosticsFloatingInformation = { link = 'DiagnosticFloatingInfo' },
@ -239,42 +212,13 @@ theme.base = {
RedrawDebugRecompose = { fg = '#ffffff', bg = p.love },
NvimInternalError = { fg = '#ffffff', bg = p.love },
}
function theme.load_terminal()
-- black
vim.g.terminal_color_0 = p.overlay
vim.g.terminal_color_8 = p.subtle
-- red
vim.g.terminal_color_1 = p.love
vim.g.terminal_color_9 = p.love
-- green
vim.g.terminal_color_2 = p.pine
vim.g.terminal_color_10 = p.pine
-- yellow
vim.g.terminal_color_3 = p.gold
vim.g.terminal_color_11 = p.gold
-- blue
vim.g.terminal_color_4 = p.foam
vim.g.terminal_color_12 = p.foam
-- magenta
vim.g.terminal_color_5 = p.iris
vim.g.terminal_color_13 = p.iris
-- cyan
vim.g.terminal_color_6 = p.rose
vim.g.terminal_color_14 = p.rose
-- white
vim.g.terminal_color_7 = p.text
vim.g.terminal_color_15 = p.text
end
theme.treesitter = {
-- TSAnnotation = {},
-- TSAttribute = {},
TSBoolean = { fg = p.rose },
-- TSCharacter = {},
TSComment = {
fg = groups.comment,
fg = config.colors.comment,
style = maybe_italic,
},
-- TSConditional = {},
@ -310,9 +254,9 @@ theme.treesitter = {
fg = p.iris,
style = maybe_italic,
},
TSPunctBracket = { fg = groups.punctuation },
TSPunctDelimiter = { fg = groups.punctuation },
TSPunctSpecial = { fg = groups.punctuation },
TSPunctBracket = { fg = config.colors.punctuation },
TSPunctDelimiter = { fg = config.colors.punctuation },
TSPunctSpecial = { fg = config.colors.punctuation },
-- TSRepeat = {},
-- TSStrike = {},
TSString = { fg = p.gold },
@ -332,9 +276,7 @@ theme.treesitter = {
style = maybe_italic,
},
TSVariableBuiltin = { fg = p.love },
}
theme.plugins = {
-- barbar.nvim
-- https://github.com/romgrk/barbar.nvim
BufferTabpageFill = { fg = p.base, bg = p.base },
@ -370,14 +312,12 @@ theme.plugins = {
-- nvim-tree.lua
-- https://github.com/kyazdani42/nvim-tree.lua
NvimTreeNormal = { fg = p.text },
NvimTreeFileDeleted = { fg = p.love },
NvimTreeFileDirty = { fg = p.rose },
NvimTreeFileMerge = { fg = p.iris },
NvimTreeFileNew = { fg = p.foam },
NvimTreeFileRenamed = { fg = p.pine },
NvimTreeFileStaged = { fg = p.iris },
NvimTreeEmptyFolderName = { fg = p.inactive },
NvimTreeFolderIcon = { fg = p.subtle },
NvimTreeFolderName = { fg = p.foam },
@ -386,7 +326,6 @@ theme.plugins = {
NvimTreeOpenedFolderName = { fg = p.foam },
NvimTreeRootFolder = { fg = p.iris },
NvimTreeSpecialFile = { link = 'NvimTreeNormal' },
NvimTreeGitDeleted = { fg = p.love },
NvimTreeGitDirty = { fg = p.rose },
NvimTreeGitIgnored = { fg = p.subtle },
@ -394,7 +333,6 @@ theme.plugins = {
NvimTreeGitNew = { fg = p.foam },
NvimTreeGitRenamed = { fg = p.pine },
NvimTreeGitStaged = { fg = p.iris },
NvimTreeWindowPicker = { fg = p.base, bg = p.iris },
-- which-key.nvim
@ -428,7 +366,10 @@ theme.plugins = {
-- neogit
-- https://github.com/TimUntersberger/neogit
NeogitDiffAddHighlight = { fg = p.foam, bg = p.highlight_med },
NeogitDiffDeleteHighlight = { fg = p.love, bg = p.highlight_med },
NeogitDiffDeleteHighlight = {
fg = p.love,
bg = p.highlight_med,
},
NeogitDiffContextHighlight = { bg = p.highlight_low },
NeogitHunkHeader = { bg = p.highlight_low },
NeogitHunkHeaderHighlight = { bg = p.highlight_low },
@ -436,16 +377,33 @@ theme.plugins = {
-- VimWiki
-- https://github.com/vimwiki/vimwiki
VimwikiHR = { fg = p.subtle },
VimwikiHeader1 = { fg = p.foam, style = 'bold' },
VimwikiHeader2 = { fg = p.foam, style = 'bold' },
VimwikiHeader3 = { fg = p.foam, style = 'bold' },
VimwikiHeader4 = { fg = p.foam, style = 'bold' },
VimwikiHeader5 = { fg = p.foam, style = 'bold' },
VimwikiHeader6 = { fg = p.foam, style = 'bold' },
VimwikiHeader1 = { fg = config.colors.headings.h1, style = 'bold' },
VimwikiHeader2 = { fg = config.colors.headings.h2, style = 'bold' },
VimwikiHeader3 = { fg = config.colors.headings.h3, style = 'bold' },
VimwikiHeader4 = { fg = config.colors.headings.h4, style = 'bold' },
VimwikiHeader5 = { fg = config.colors.headings.h5, style = 'bold' },
VimwikiHeader6 = { fg = config.colors.headings.h6, style = 'bold' },
VimwikiHeaderChar = { fg = p.pine },
VimwikiLink = { fg = p.rose },
VimwikiList = { fg = p.iris },
VimwikiNoExistsLink = { fg = p.love },
}
vim.g.terminal_color_0 = p.overlay -- black
vim.g.terminal_color_8 = p.subtle -- bright black
vim.g.terminal_color_1 = p.love -- red
vim.g.terminal_color_9 = p.love -- bright red
vim.g.terminal_color_2 = p.pine -- green
vim.g.terminal_color_10 = p.pine -- bright green
vim.g.terminal_color_3 = p.gold -- yellow
vim.g.terminal_color_11 = p.gold -- bright yellow
vim.g.terminal_color_4 = p.foam -- blue
vim.g.terminal_color_12 = p.foam -- bright blue
vim.g.terminal_color_5 = p.iris -- magenta
vim.g.terminal_color_13 = p.iris -- bright magenta
vim.g.terminal_color_6 = p.rose -- cyan
vim.g.terminal_color_14 = p.rose -- bright cyan
vim.g.terminal_color_7 = p.text -- white
vim.g.terminal_color_15 = p.text -- bright white
return theme

View file

@ -1,63 +0,0 @@
local util = {}
util.highlight = function(group, color)
local style = color.style and 'gui=' .. color.style or 'gui=NONE'
local fg = color.fg and 'guifg=' .. color.fg or 'guifg=NONE'
local bg = color.bg and 'guibg=' .. color.bg or 'guibg=NONE'
local sp = color.sp and 'guisp=' .. color.sp or ''
local hl = 'highlight '
.. group
.. ' '
.. style
.. ' '
.. fg
.. ' '
.. bg
.. ' '
.. sp
vim.cmd(hl)
if color.link then
vim.cmd('highlight! link ' .. group .. ' ' .. color.link)
end
end
function util.load()
if vim.g.colors_name then
vim.cmd('hi clear')
end
vim.o.termguicolors = true
vim.g.colors_name = 'rose-pine'
if vim.o.background == 'light' and vim.g.rose_pine_variant == nil then
vim.g.rose_pine_variant = 'dawn'
elseif
vim.g.rose_pine_variant == 'dawn'
or vim.g.rose_pine_variant == 'rose-pine-dawn'
then
vim.o.background = 'light'
end
local theme = require('rose-pine.theme')
theme.load_terminal()
for group, colors in pairs(theme.base) do
util.highlight(group, colors)
end
for group, colors in pairs(theme.treesitter) do
util.highlight(group, colors)
end
for group, colors in pairs(theme.plugins) do
util.highlight(group, colors)
end
-- Load galaxyline theme
require("rose-pine.galaxyline.theme")
end
return util

View file

@ -69,49 +69,36 @@ use({
## Options
> Options should be set before colorscheme
### Interface
> Options should be set **before** colorscheme
```lua
-- Set variant
-- Defaults to 'dawn' if vim background is light
-- @usage 'base' | 'moon' | 'dawn' | 'rose-pine[-moon][-dawn]'
vim.g.rose_pine_variant = 'base'
-- Set theme variant
-- Matches terminal theme if unset
-- @usage 'main' | 'moon' | 'dawn'
vim.g.rose_pine_variant = 'dawn'
-- Disable italics
vim.g.rose_pine_bold_vertical_split_line = true
vim.g.rose_pine_disable_background = false
vim.g.rose_pine_disable_italics = false
-- Use terminal background
vim.g.rose_pine_disable_background = false
-- Use bold vertical split line
vim.g.rose_pine_bold_vertical_split_line = true
```
### Custom colours
```lua
local p = require('rose-pine.palette')
vim.g.rose_pine_colors = {
punctuation = '#fa8072',
comment = '#ffffff',
hint = '#9745be',
info = '#78ccc5',
warn = '#f5c359',
error = '#c75c6a',
headings = {
h1 = '#999999',
h2 = '#888888',
h3 = '#777777',
h4 = '#666666',
h5 = '#555555',
}
punctuation = p.subtle,
comment = p.subtle,
hint = p.iris,
info = p.foam,
warn = p.gold,
error = p.love,
headings = {
h1 = p.foam,
h2 = p.foam,
h3 = p.foam,
h4 = p.foam,
h5 = p.foam,
h6 = p.foam,
},
}
```
Be sure to set the colorscheme _after_ options
```lua
-- Set colorscheme after options
vim.cmd('colorscheme rose-pine')
```
@ -119,26 +106,28 @@ vim.cmd('colorscheme rose-pine')
## Functions
```lua
-- Toggle between the three variants
require('rose-pine.functions').toggle_variant()
-- Toggle between all variants
require('rose-pine').toggle()
-- Toggle between base and dawn
require('rose-pine.functions').toggle_variant({'base', 'dawn'})
-- Toggle between some variants
require('rose-pine').toggle({'main', 'dawn'})
-- Switch to specified variant
require('rose-pine.functions').select_variant('moon')
-- Set specific variant
require('rose-pine').set('moon')
```
## Keymaps
```lua
-- Toggle variant
vim.api.nvim_set_keymap('n', '<c-m>', [[<cmd>lua require('rose-pine.functions').toggle_variant()<cr>]], { noremap = true, silent = true })
> These are only suggestions; no keymaps are set by the theme
-- Select each variant
vim.api.nvim_set_keymap('n', '<c-8>', [[<cmd>lua require('rose-pine.functions').select_variant('dawn')<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-9>', [[<cmd>lua require('rose-pine.functions').select_variant('moon')<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-0>', [[<cmd>lua require('rose-pine.functions').select_variant('base')<cr>]], { noremap = true, silent = true })
```lua
-- Toggle variants
vim.api.nvim_set_keymap('n', '<c-m>', [[<cmd>lua require('rose-pine').toggle()<cr>]], { noremap = true, silent = true })
-- Set variant
vim.api.nvim_set_keymap('n', '<c-0>', [[<cmd>lua require('rose-pine').set('main')<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-9>', [[<cmd>lua require('rose-pine').set('moon')<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-8>', [[<cmd>lua require('rose-pine').set('dawn')<cr>]], { noremap = true, silent = true })
```
## Contributing