From 2efc0d1efaf8c66b93fc594ba17b261f8de0161d Mon Sep 17 00:00:00 2001 From: Michael Chris Lopez Date: Wed, 20 Oct 2021 15:35:17 +0800 Subject: [PATCH] config for comments contrast --- doc/zenbones.md | 10 ++++++++++ lua/zenbones/specs/dark.lua | 5 +++-- lua/zenbones/specs/init.lua | 18 ++++++++++-------- lua/zenbones/specs/light.lua | 5 +++-- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/zenbones.md b/doc/zenbones.md index 85ed7e6..f80c210 100644 --- a/doc/zenbones.md +++ b/doc/zenbones.md @@ -59,6 +59,16 @@ Default: `v:false`. Make non-current window background warmer than _Normal_. Default: `v:true`. Make comments italicize. +#### g:zenbones_darken_comments + +Default: 38. Percentage to darken comments. Comments base their fg color on the +bg palette. See also |lush-color-darken|. + +#### g:zenflesh_lighten_comments + +Default: 38. Percentage to lighten comments. Comments base their fg color on the +bg palette. See also |lush-color-lighten|. + #### g:zenbones_compat Set to `1` to turn on compatibility mode. diff --git a/lua/zenbones/specs/dark.lua b/lua/zenbones/specs/dark.lua index 425fcc0..dd923b2 100644 --- a/lua/zenbones/specs/dark.lua +++ b/lua/zenbones/specs/dark.lua @@ -12,7 +12,8 @@ local function generate(p, opt) vim.notify(error_msg, vim.log.levels.WARN) end - local comment_gui = opt.comment_gui + local lighten_comment = opt.lighten_comment or 38 + local comment_gui = opt.comment_gui or "italic" -- stylua: ignore start local theme = lush(function() @@ -39,7 +40,7 @@ local function generate(p, opt) ErrorMsg { Error }, -- error messages on the command line WarningMsg { fg = p.wood }, -- warning messages - Comment { fg = p.bg.li(38).de(24), gui = comment_gui }, -- any comment + Comment { fg = p.bg.li(lighten_comment).de(24), gui = comment_gui }, -- any comment Conceal { fg = p.fg.da(20), gui = "bold,italic" }, -- placeholder characters substituted for concealed text (see 'conceallevel') Cursor { bg = p.fg.li(20), fg = p.bg.da(20) }, -- character under the cursor diff --git a/lua/zenbones/specs/init.lua b/lua/zenbones/specs/init.lua index 07f3f3f..7a92578 100644 --- a/lua/zenbones/specs/init.lua +++ b/lua/zenbones/specs/init.lua @@ -1,20 +1,22 @@ local M = {} function M.get_global_config(prefix, base_bg) + local common = { + solid_vert_split = vim.g[prefix .. "_solid_vert_split"], + comment_gui = vim.g[prefix .. "_italic_comments"] ~= false and "italic" or "NONE", + } if base_bg == "light" then - return { + return vim.tbl_extend("keep", { lightness = vim.g[prefix .. "_lightness"], - comment_gui = vim.g[prefix .. "_italic_comments"] ~= false and "italic" or "NONE", dim_noncurrent_window = vim.g[prefix .. "_dim_noncurrent_window"], - solid_vert_split = vim.g[prefix .. "_solid_vert_split"], - } + darken_comment = vim.g[prefix .. "_darken_comment"], + }, common) else - return { + return vim.tbl_extend("keep", { darkness = vim.g[prefix .. "_darkness"], - comment_gui = vim.g[prefix .. "_italic_comments"] ~= false and "italic" or "NONE", lighten_noncurrent_window = vim.g[prefix .. "_lighten_noncurrent_window"], - solid_vert_split = vim.g[prefix .. "_solid_vert_split"], - } + lighten_comment = vim.g[prefix .. "_lighten_comment"], + }, common) end end diff --git a/lua/zenbones/specs/light.lua b/lua/zenbones/specs/light.lua index 5548eff..80b9f2d 100644 --- a/lua/zenbones/specs/light.lua +++ b/lua/zenbones/specs/light.lua @@ -12,7 +12,8 @@ local function generate(p, opt) vim.notify(error_msg, vim.log.levels.WARN) end - local comment_gui = opt.comment_gui + local darken_comment = opt.darken_comment or 38 + local comment_gui = opt.comment_gui or "italic" -- stylua: ignore start local theme = lush(function() @@ -39,7 +40,7 @@ local function generate(p, opt) ErrorMsg { Error }, -- error messages on the command line WarningMsg { fg = p.wood }, -- warning messages - Comment { fg = p.bg.da(38).de(28), gui = comment_gui }, -- any comment + Comment { fg = p.bg.da(darken_comment).de(28), gui = comment_gui }, -- any comment Conceal { fg = p.fg.li(20), gui = "bold,italic" }, -- placeholder characters substituted for concealed text (see 'conceallevel') Cursor { bg = p.fg, fg = p.bg.li(20) }, -- character under the cursor