diff --git a/README.md b/README.md index 5eac93a..e077f14 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ You can search `--[[--]]` to view its value for `
` in same b For `
`, ``, `` tag explanations, read [inspect.lua](https://github.com/kikito/inspect.lua#examples-of-use). -### Plugin Manager +## Plugin Manager Choose your favorite plugin manager. Now available: `vim-plug` (default) and `packer`. @@ -307,7 +307,7 @@ The plugins directory maneged by vim-plug is different from packer. When you mod - Packer [default config](./lua/one/config/packer.lua) - Vim-Plug [default config](./lua/one/config/vim-plug.lua) -### Plugin +## Plugin All plugins can be turned off, overridden default config options, replaced with your favorites. It is highly flexible to be customized and extended. @@ -316,7 +316,7 @@ Read [./doc/plugin.md](./doc/plugin.md) for plugin definitions and references. You can even set `onlyPlugins = {}` to disable all plugins. Read [Debug - Disable other plugins](./doc/debug.md#disable-other-plugins). -### Colors and Highlights +## Colors and Highlights It's highly dependent on [treesitter][]. If syntax highlights not work, check your [treesitter parsers](https://github.com/nvim-treesitter/nvim-treesitter#language-parsers) correct. Read [./doc/treesitter.md](./doc/treesitter.md) for troubleshooting. @@ -324,7 +324,16 @@ Read [./doc/treesitter.md](./doc/treesitter.md) for troubleshooting. You can override the default colors and highlights. Read [./doc/colors.md](./doc/colors.md) for more details. -### Proxy +### Color Gamut + +The colors are desiged based on [Display P3](https://www.color.org/chardata/rgb/DisplayP3.xalter) color gamut. It works for MacOS and iTerm2 users. + +If your nvim colors looks different from below picture. Your terminal is not under Display P3 color gamut. +You may try [sRGB colors](lua/one/colors/srgb.lua). Read [Colors - Color Gamut](./doc/colors.md#color-gamut) for details. + +![colors.png](https://media.githubusercontent.com/media/adoyle-h/_imgs/master/github/one.nvim/colors.png) + +## Proxy ```lua require('one').setup { diff --git a/README.zh.md b/README.zh.md index 0465caf..1fdd0d3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -287,7 +287,7 @@ require('one').setup { 会有例如 `
` 这样的标记。这是为了避免重复,对于 `
` 搜索文件内对应的 `--[[
--]]` 即可找到相应的值。 `
`, ``, `` 等标记的解释详见 [inspect.lua](https://github.com/kikito/inspect.lua#examples-of-use)。 -### 插件管理器 +## 插件管理器 选择你喜欢的插件管理器,目前提供 `vim-plug` (默认) 和 `packer`。 @@ -304,7 +304,7 @@ vim-plug 管理的插件目录和 packer 管理的是不一样的。当你改变 - Packer [默认配置](./lua/one/config/packer.lua) - Vim-Plug [默认配置](./lua/one/config/vim-plug.lua) -### 插件 +## 插件 所有插件都可以被关闭,覆盖默认配置项,或者替换成你喜欢的插件。自定义配置和扩展非常方便。 @@ -312,7 +312,7 @@ vim-plug 管理的插件目录和 packer 管理的是不一样的。当你改变 你甚至可以设置 `onlyPlugins = {}` 来一键禁用所有插件(不禁用插件管理器)。详见 [Debug - Disable other plugins](./doc/debug.md#disable-other-plugins)。 -### 颜色和高亮 +## 颜色和高亮 本项目高度依赖 [treesitter][]。如果语法高亮失效,检查你的 [treesitter parsers](https://github.com/nvim-treesitter/nvim-treesitter#language-parsers) 是否正常。 阅读 [./doc/treesitter.md](./doc/treesitter.md) 查看如何排查。 @@ -320,7 +320,16 @@ vim-plug 管理的插件目录和 packer 管理的是不一样的。当你改变 你可以修改默认配色和高亮。 阅读 [./doc/colors.md](./doc/colors.md) 查看更多细节。 -### 代理 +### 色域 + +本项目的颜色是根据 [Display P3](https://www.color.org/chardata/rgb/DisplayP3.xalter) 色域设计的。对于 MacOS 系统和 iTerm2 用户友好。 + +如果你的 nvim 配色看起来跟下图有点不一样。你的终端应该不是处于 Display P3 色域。 +你可以尝试 [sRGB 配色](lua/one/colors/srgb.lua)。详见[颜色 - 色域](./doc/colors.md#color-gamut)。 + +![colors.png](https://media.githubusercontent.com/media/adoyle-h/_imgs/master/github/one.nvim/colors.png) + +## 代理 ```lua require('one').setup { diff --git a/doc/colors.md b/doc/colors.md index effd1e5..e571fbe 100644 --- a/doc/colors.md +++ b/doc/colors.md @@ -12,17 +12,45 @@ You can change the colors and highlights. The priority from high to low: -- [`config.colors`](lua/one/config/colors.lua) +- [`config.colors`](../lua/one/colors/display-p3.lua) - colors and highlights defined in each plugin - [`colors/highlights`](lua/one/plugins/colors/highlights.lua) - colors and highlights defined in [theme plugin](lua/one/plugins/themes/init.lua) - syntax highlights by nvim-treesitter +## Color Gamut + +The colors are desiged based on [Display P3](https://www.color.org/chardata/rgb/DisplayP3.xalter) color gamut. It works for MacOS and iTerm2 users. + +If your nvim colors looks different from below picture. Your terminal is not under Display P3 color gamut. +You may try [sRGB colors](../lua/one/colors/srgb.lua). + +![colors.png](https://media.githubusercontent.com/media/adoyle-h/_imgs/master/github/one.nvim/colors.png) + +The color gamut is managed by your terminal application and operator system. +You should choose the right color gamut for your environment. + +Current one.nvim provides [Display P3](../lua/one/colors/display-p3.lua) and [sRGB](../lua/one/colors/srgb.lua) color presets. +And use Display P3 presets by default. You can use sRGB presets like below codes. + +```lua +require('one').setup { + config = { + colors = require('one.colors.srgb') + } +} +``` + +For Kitty users, you should set [`macos_colorspace displayp3`](https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.macos_colorspace) in kitty config. Or set `macos_colorspace srgb` and use the sRGB color presets. + +For windows users, read [Microsoft - About Color Management +](https://support.microsoft.com/en-us/windows/about-color-management-2a2ed8fa-cf09-83c5-e55c-d1428519f616) and [Windows Central - How to find the right color profile for your monitor using Windows 10](https://www.windowscentral.com/how-configure-correct-color-profile-your-monitor-windows-10). (Even though one.nvim not work for windows users for current) + ## The background, frontground, cursorline colors Change basic colors via `config.colors`. -Default color configs is defined in [./lua/one/config/colors.lua](./lua/one/config/colors.lua). +Default color configs is defined in [../lua/one/colors/display-p3.lua](../lua/one/colors/display-p3.lua). ```lua require('one').setup { diff --git a/lua/one/colors/display-p3.lua b/lua/one/colors/display-p3.lua new file mode 100644 index 0000000..61ec6ef --- /dev/null +++ b/lua/one/colors/display-p3.lua @@ -0,0 +1,51 @@ +local colors = { -- basic colors + black = '#101012', + grey1 = '#18191B', + grey2 = '#242629', + grey3 = '#34373B', + grey4 = '#484D52', + grey = '#6C6F7F', + white = '#ACAFB4', + green = '#63D846', + orange = '#D75F00', + blue = '#689AFD', + cyan = '#ACCBE1', + purple = '#765ADA', + yellow = '#C3B11A', + red = '#BF3100', + + lightYellow = '#FFFFED', + lightGreen = '#C4D697', + lightPurple = '#B197D6', + + darkGreen = '#13230c', + darkBlue = '#181928', + darkCyan = '#0c1820', + darkRed = '#1F0909', + darkYellow = '#212100', + darkOrange = '#371B00', + darkPurple = '#180225', +} + +local functionsColors = { -- + cursorLine = colors.darkBlue, + cursorLineNrFG = colors.blue, + cursorLineNrBG = colors.darkBlue, + + linkFG = '#30B17D', + comment = colors.grey, + scrollbarBG = '#0E2851', + + match = { fg = colors.orange }, + + diff = { + add = { bg = colors.darkGreen }, + delete = { fg = colors.red, bg = colors.darkRed }, + change = { bg = colors.darkYellow }, + text = { bg = '#353513' }, + }, +} + +for k, v in pairs(functionsColors) do colors[k] = v end + +return colors diff --git a/lua/one/colors/srgb.lua b/lua/one/colors/srgb.lua new file mode 100644 index 0000000..fe92350 --- /dev/null +++ b/lua/one/colors/srgb.lua @@ -0,0 +1,51 @@ +local colors = { -- basic colors + black = '#101012', + grey1 = '#18191B', + grey2 = '#242629', + grey3 = '#34373B', + grey4 = '#474D53', + grey = '#6B6F80', + white = '#ABAFB5', + green = '#00DB1B', + orange = '#E85500', + blue = '#589CFF', + cyan = '#A4CCE3', + purple = '#7B59E2', + yellow = '#C7B000', + red = '#D01A00', + + lightYellow = '#FFFFEB', + lightGreen = '#C0D78F', + lightPurple = '#B696DB', + + darkGreen = '#0D2409', + darkBlue = '#181929', + darkCyan = '#081821', + darkRed = '#220708', + darkYellow = '#212100', + darkOrange = '#3B1900', + darkPurple = '#1B0127', +} + +local functionsColors = { -- + cursorLine = colors.darkBlue, + cursorLineNrFG = colors.blue, + cursorLineNrBG = colors.darkBlue, + + linkFG = '#00B479', + comment = colors.grey, + scrollbarBG = '#022954', + + match = { fg = colors.orange }, + + diff = { + add = { bg = colors.darkGreen }, + delete = { fg = colors.red, bg = colors.darkRed }, + change = { bg = colors.darkYellow }, + text = { bg = '#35350C' }, + }, +} + +for k, v in pairs(functionsColors) do colors[k] = v end + +return colors diff --git a/lua/one/config.lua b/lua/one/config.lua index 9651818..6aac44f 100644 --- a/lua/one/config.lua +++ b/lua/one/config.lua @@ -15,7 +15,7 @@ end -- @param conf {table} user config function CM.setup(conf) local defaultConfigFn = require('one.config.default') - local defaultColors = require('one.config.colors') + local defaultColors = require('one.colors.display-p3') local colors = util.merge(defaultColors, conf.colors) local defaultConfig = defaultConfigFn(colors) diff --git a/lua/one/config/colors.lua b/lua/one/config/colors.lua index b0a6518..87003a1 100644 --- a/lua/one/config/colors.lua +++ b/lua/one/config/colors.lua @@ -1,30 +1,30 @@ local colors = { -- basic colors - black = '#101012', - grey1 = '#18191B', - grey2 = '#242629', - grey3 = '#34373B', - grey4 = '#484D52', - grey = '#6C6F7F', - white = '#ACAFB4', - green = '#75C44E', - orange = '#D75F00', - blue = '#689AFD', - cyan = '#ACCBE1', - purple = '#765ADA', -- '#574AB2', - yellow = '#C3B11A', -- '#E3D888' '#FFE787' '#D1D0A3' - red = '#BF3100', - - lightYellow = '#FFFFED', - lightGreen = '#C4D697', - lightPurple = '#B197D6', - - darkGreen = '#13230c', - darkBlue = '#181928', - darkCyan = '#0c1820', - darkRed = '#1F0909', -- '#340009' - darkYellow = '#212100', - darkOrange = '#371B00', - darkPurple = '#180225', + black = '#101012', -- #101012 + grey1 = '#18191B', -- #18191B + grey2 = '#242629', -- #242629 + grey3 = '#34373B', -- #33373B + grey4 = '#484D52', -- #474D53 + grey = '#6C6F7F', -- #6B6F80 + white = '#ACAFB4', -- #ABAFB5 + green = '#75C44E', -- #00DB1B + orange = '#D75F00', -- #E85500 + blue = '#689AFD', -- #589CFF + cyan = '#ACCBE1', -- #A4CCE3 + purple = '#765ADA', -- #7B59E2 '#574AB2', + yellow = '#C3B11A', -- #C7B000 '#E3D888' '#FFE787' '#D1D0A3' + red = '#BF3100', -- #D01C00 + + lightYellow = '#FFFFED', -- #FFFFEB + lightGreen = '#C4D697', -- #C0D78F + lightPurple = '#B197D6', -- #B696DB + + darkGreen = '#13230c', -- #0D2409 + darkBlue = '#181928', -- #181929 + darkCyan = '#0c1820', -- #081821 + darkRed = '#1F0909', -- #220708 '#340009' + darkYellow = '#212100', -- #212100 + darkOrange = '#371B00', -- #3B1900 + darkPurple = '#180225', -- #1B0127 } local functionsColors = { -- @@ -32,9 +32,9 @@ local functionsColors = { -- cursorLineNrFG = colors.blue, cursorLineNrBG = colors.darkBlue, - linkFG = '#30B17D', + linkFG = '#30B17D', -- #00B479 comment = colors.grey, - scrollbarBG = '#0E2851', + scrollbarBG = '#0E2851', -- #022954 match = { fg = colors.orange }, @@ -42,7 +42,7 @@ local functionsColors = { -- add = { bg = colors.darkGreen }, delete = { fg = colors.red, bg = colors.darkRed }, change = { bg = colors.darkYellow }, - text = { bg = '#353513' }, + text = { bg = '#353513' }, -- #35350C }, } diff --git a/lua/one/plugins/treesitter/highlights.lua b/lua/one/plugins/treesitter/highlights.lua index 14e8e64..a1ac27d 100644 --- a/lua/one/plugins/treesitter/highlights.lua +++ b/lua/one/plugins/treesitter/highlights.lua @@ -27,7 +27,7 @@ return function(config) -- Literals ['@string'] = { link = 'String' }, - ['@string.regex'] = { fg = '#47A169' }, + ['@string.regex'] = { fg = '#47A169' }, -- #00A463 ['@string.escape'] = { link = 'SpecialChar' }, -- For escape characters within a string. ['@string.special'] = { link = 'SpecialChar' }, -- For strings with special meaning that don't fit into the above categories. @@ -42,7 +42,7 @@ return function(config) -- Functions ['@function'] = { link = 'Function' }, ['@function.call'] = { link = 'Function' }, - ['@function.builtin'] = { fg = '#3D84FF' }, -- For builtin functions: `pairs`, `pcall`, `table.insert` in Lua. + ['@function.builtin'] = { fg = '#3D84FF' }, -- #1086FF -- For builtin functions: `pairs`, `pcall`, `table.insert` in Lua. ['@function.macro'] = { link = 'Macro' }, -- For macro defined functions (calls and definitions) ['@method'] = { link = 'Function' }, ['@method.call'] = { link = 'Function' }, @@ -52,7 +52,7 @@ return function(config) -- Keywords ['@keyword'] = { link = 'Keyword' }, - ['@keyword.function'] = { fg = '#2F66FF' }, + ['@keyword.function'] = { fg = '#2F66FF' }, -- #0F68FF ['@keyword.operator'] = { fg = c.purple, italic = true }, -- e.g. `and`, `as`, `or`. ['@keyword.return'] = { link = 'Keyword' }, @@ -65,13 +65,13 @@ return function(config) -- Types ['@type'] = { link = 'Type' }, - ['@type.builtin'] = { fg = '#DB852C' }, + ['@type.builtin'] = { fg = '#DB852C' }, -- #E98000 ['@type.qualifier'] = { link = 'Type' }, ['@type.definition'] = { link = 'Typedef' }, ['@storageclass'] = { link = 'StorageClass' }, - ['@field'] = { fg = '#B1A983' }, -- #A99C37 #75902F #90852F '#C75D14' - ['@property'] = { fg = '#5098A3' }, + ['@field'] = { fg = '#B1A983' }, -- #B3A97E #A99C37 #75902F #90852F '#C75D14' + ['@property'] = { fg = '#5098A3' }, -- #2E9AA5 -- Identifiers ['@variable'] = { fg = c.white },