customized

This commit is contained in:
Eric Xiao 2022-10-17 19:58:22 -07:00
commit ebb228a441
6 changed files with 59 additions and 263 deletions

View file

@ -1,12 +0,0 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
[*.lua]
indent_size = 3
indent_style = tab

View file

@ -1,4 +0,0 @@
column_width = 80
indent_type = "Tabs"
line_endings = "Unix"
quote_style = "AutoPreferSingle"

View file

@ -2,68 +2,6 @@ local util = require('rose-pine.util')
local M = {}
local config = {
bold_vert_split = false,
dark_variant = 'main',
dim_nc_background = false,
disable_background = false,
disable_float_background = false,
disable_italics = false,
groups = {
background = 'base',
panel = 'surface',
border = 'highlight_med',
comment = 'muted',
link = 'iris',
punctuation = 'muted',
error = 'love',
hint = 'iris',
info = 'foam',
warn = 'gold',
git_add = 'foam',
git_change = 'rose',
git_delete = 'love',
git_dirty = 'rose',
git_ignore = 'muted',
git_merge = 'iris',
git_rename = 'pine',
git_stage = 'iris',
git_text = 'rose',
headings = {
h1 = 'iris',
h2 = 'foam',
h3 = 'rose',
h4 = 'gold',
h5 = 'pine',
h6 = 'foam',
},
},
highlight_groups = {},
}
function M.setup(opts)
opts = opts or {}
vim.g.rose_pine_variant = opts.dark_variant or 'main'
if opts.groups and type(opts.groups.headings) == 'string' then
opts.groups.headings = {
h1 = opts.groups.headings,
h2 = opts.groups.headings,
h3 = opts.groups.headings,
h4 = opts.groups.headings,
h5 = opts.groups.headings,
h6 = opts.groups.headings,
}
end
config.user_variant = opts.dark_variant or nil
config = vim.tbl_deep_extend('force', config, opts)
end
function M.colorscheme()
if vim.g.colors_name then
vim.cmd('hi clear')
@ -72,19 +10,11 @@ function M.colorscheme()
vim.opt.termguicolors = true
vim.g.colors_name = 'rose-pine'
local theme = require('rose-pine.theme').get(config)
local theme = require('rose-pine.theme').get()
-- Set theme highlights
for group, color in pairs(theme) do
-- Skip highlight group if user overrides
if config.highlight_groups[group] == nil then
util.highlight(group, color)
end
end
-- Set user highlights
for group, color in pairs(config.highlight_groups) do
util.highlight(group, color)
util.highlight(group, color)
end
end

View file

@ -1,66 +1,20 @@
local variants = {
main = {
base = '#191724',
surface = '#1f1d2e',
overlay = '#26233a',
muted = '#6e6a86',
subtle = '#908caa',
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',
},
moon = {
base = '#232136',
surface = '#2a273f',
overlay = '#393552',
muted = '#6e6a86',
subtle = '#908caa',
text = '#e0def4',
love = '#eb6f92',
gold = '#f6c177',
rose = '#ea9a97',
pine = '#3e8fb0',
foam = '#9ccfd8',
iris = '#c4a7e7',
highlight_low = '#2a283e',
highlight_med = '#44415a',
highlight_high = '#56526e',
none = 'NONE',
},
dawn = {
base = '#faf4ed',
surface = '#fffaf3',
overlay = '#f2e9e1',
muted = '#9893a5',
subtle = '#797593',
text = '#575279',
love = '#b4637a',
gold = '#ea9d34',
rose = '#d7827e',
pine = '#286983',
foam = '#56949f',
iris = '#907aa9',
highlight_low = '#f4ede8',
highlight_med = '#dfdad9',
highlight_high = '#cecacd',
none = 'NONE',
},
local palette = {
base = '#171524',
surface = '#1f1d2e',
overlay = '#26233a',
muted = '#6e6a86',
subtle = '#908caa',
text = '#e0def4',
love = '#eb6f92',
gold = '#f69957',
rose = '#ebbcba',
pine = '#cd51d5',
foam = '#9ccfd8',
iris = '#c4a7e7',
highlight_low = '#21202e',
highlight_med = '#403d52',
highlight_high = '#524f67',
none = 'NONE'
}
local palette = {}
if vim.o.background == 'light' then
palette = variants.dawn
else
palette = variants[(vim.g.rose_pine_variant == 'moon' and 'moon') or 'main']
end
return palette

View file

@ -2,21 +2,50 @@ local blend = require('rose-pine.util').blend
local M = {}
function M.get(config)
function M.get()
local p = require('rose-pine.palette')
local theme = {}
local groups = config.groups or {}
local styles = {
italic = (config.disable_italics and p.none) or 'italic',
vert_split = (config.bold_vert_split and groups.border) or p.none,
background = (config.disable_background and p.none)
or groups.background,
float_background = (config.disable_float_background and p.none)
or groups.panel,
local groups = {
background = 'base',
panel = 'surface',
border = 'highlight_med',
comment = 'muted',
link = 'iris',
punctuation = 'muted',
error = 'love',
hint = 'iris',
info = 'foam',
warn = 'gold',
git_add = 'foam',
git_change = 'rose',
git_delete = 'love',
git_dirty = 'rose',
git_ignore = 'muted',
git_merge = 'iris',
git_rename = 'pine',
git_stage = 'iris',
git_text = 'rose',
headings = {
h1 = 'iris',
h2 = 'foam',
h3 = 'rose',
h4 = 'gold',
h5 = 'pine',
h6 = 'foam',
},
}
styles.nc_background = (config.dim_nc_background and groups.panel)
or styles.background
local styles = {
italic = 'italic',
vert_split = p.none,
background = groups.background,
float_background = groups.panel,
}
styles.nc_background = styles.background
theme = {
ColorColumn = { bg = p.overlay },

103
readme.md
View file

@ -1,102 +1 @@
<p align="center">
<img src="https://github.com/rose-pine/rose-pine-theme/raw/main/assets/icon.png" width="80" />
<h2 align="center">Rosé Pine for Neovim</h2>
</p>
<p align="center">All natural pine, faux fur and a bit of soho vibes for the classy minimalist</p>
<p align="center">
<a href="https://github.com/rose-pine/rose-pine-theme">
<img src="https://img.shields.io/badge/community-rosé%20pine-26233a?labelColor=191724&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwIiBoZWlnaHQ9IjIzNyIgdmlld0JveD0iMCAwIDI1MCAyMzciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xNjEuMjI3IDE2MS4yNTFDMTMyLjE1NCAxNjkuMDQxIDExNC45MDEgMTk4LjkyNCAxMjIuNjkxIDIyNy45OTdDMTIzLjkyNSAyMzIuNjAzIDEyOC42NTkgMjM1LjMzNiAxMzMuMjY0IDIzNC4xMDJMMTg1LjkwNyAyMTkuOTk2QzIxOS41ODUgMjEwLjk3MiAyMzk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S43MTcgNDguOTc2NCAxNzEuNzE3IDc1LjEyNjNaIiBmaWxsPSIjRUJCQ0JBIi8+CjxwYXRoIGQ9Ik0xNDQuMjE3IDg2LjIzNzlDMTYxLjY0OSA1Ni4wNDMyIDE1MS4zMDMgMTcuNDMyOSAxMjEuMTA4IDBMMTA2LjA2IDI2LjA2NDRDODguNjI3IDU2LjI1OSA5OC45NzM2IDk0Ljg2OTQgMTI5LjE2OCAxMTIuMzAyTDE0NC4yMTcgODYuMjM3OVoiIGZpbGw9IiNFQkJDQkEiLz4KPHBhdGggZD0iTTEyNS4yOTkgNjAuOTc4OUMxMTYuMjc1IDI3LjMwMTIgODEuNjU3NSA3LjMxNTY3IDQ3Ljk3OTcgMTYuMzM5Nkw2NC4zMTk3IDc3LjMyMTFDNzMuMzQzNiAxMTAuOTk5IDEwNy45NjEgMTMwLjk4NCAxNDEuNjM5IDEyMS45NkwxMjUuMjk5IDYwLjk3ODlaIiBmaWxsPSIjRUJCQ0JBIi8+CjxwYXRoIGQ9Ik0xMjQuOTI2IDYwLjk3ODlDMTMzLjk1IDI3LjMwMTIgMTY4LjU2NyA3LjMxNTY3IDIwMi4yNDUgMTYuMzM5NkwxODUuOTA1IDc3LjMyMTFDMTc2Ljg4MSAxMTAuOTk5IDE0Mi4yNjMgMTMwLjk4NCAxMDguNTg2IDEyMS45NkwxMjQuOTI2IDYwLjk3ODlaIiBmaWxsPSIjRUJCQ0JBIi8+Cjwvc3ZnPgo=&style=for-the-badge" />
</a>
</p>
## Usage
> With [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use({
'rose-pine/neovim',
as = 'rose-pine',
config = function()
vim.cmd('colorscheme rose-pine')
end
})
```
_Supported plugins are listed in the [wiki](https://github.com/rose-pine/neovim/wiki#supported-plugins)_
## Gallery
**Rosé Pine**
![Rosé Pine with Neovim](https://user-images.githubusercontent.com/1973/163921570-0f577baf-3199-4f09-9779-a7eb9238151a.png)
**Rosé Pine Moon**
![Rosé Pine Moon with Neovim](https://user-images.githubusercontent.com/1973/163921620-d3acd0d2-d227-4d28-a5e8-97ff22e56c6d.png)
**Rosé Pine Dawn**
![Rosé Pine Dawn with Neovim](https://user-images.githubusercontent.com/1973/163921656-644a2db3-c55c-4e89-9bdd-39cdd7a2681b.png)
## Options
> Options should be set **before** colorscheme
Variant respects `vim.o.background`, using dawn when light and `dark_variant` when dark
```lua
require('rose-pine').setup({
--- @usage 'main' | 'moon'
dark_variant = 'main',
bold_vert_split = false,
dim_nc_background = false,
disable_background = false,
disable_float_background = false,
disable_italics = false,
--- @usage string hex value or named color from rosepinetheme.com/palette
groups = {
background = 'base',
panel = 'surface',
border = 'highlight_med',
comment = 'muted',
link = 'iris',
punctuation = 'subtle',
error = 'love',
hint = 'iris',
info = 'foam',
warn = 'gold',
headings = {
h1 = 'iris',
h2 = 'foam',
h3 = 'rose',
h4 = 'gold',
h5 = 'pine',
h6 = 'foam',
}
-- or set all headings at once
-- headings = 'subtle'
},
-- Change specific vim highlight groups
highlight_groups = {
ColorColumn = { bg = 'rose' }
}
})
-- set colorscheme after options
vim.cmd('colorscheme rose-pine')
```
## Contributing
We welcome and appreciate any help in creating a lovely experience for all.
- [Get highlight groups under cursor](https://github.com/nvim-treesitter/playground#show-treesitter-and-syntax-highlight-groups-under-the-cursor)
- [Adding new highlight groups](https://github.com/rose-pine/neovim/issues/6#issuecomment-962466323)
- [Palette reference by name](https://rosepinetheme.com/palette)
# My customized Rose Pine