From 3227bddc031c31475e9575bbaf6d92b0ba65b4f4 Mon Sep 17 00:00:00 2001 From: Abdulkaiz Khatri <24286590+ful1e5@users.noreply.github.com> Date: Wed, 26 Jul 2023 15:15:06 +0530 Subject: [PATCH] feat: Implement highlight-blend feature Related to #251 --- CHANGELOG.md | 12 ++++++++++++ Usage.md | 15 ++++++++------- doc/github-nvim-theme.txt | 12 +++++++----- lua/github-theme/lib/compiler.lua | 1 + lua/github-theme/util/template.lua | 6 +++++- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e178d0a6..b7233d1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +### What's New? + +- Implement [highlight-blend](https://neovim.io/doc/user/syntax.html#highlight-blend) feature #251 + +### Changes + +- + +### Issues Fix + +- + ## [v1.0.1] - 23 July 2023 ### What's New? diff --git a/Usage.md b/Usage.md index a99996b9..41b4f3a3 100644 --- a/Usage.md +++ b/Usage.md @@ -365,13 +365,14 @@ These values are: `add`, `removed`, `changed`, `conflict`, and `ignored`. A `group` is the definition of a `highlight-group`. The key of the group table is the `highlight-group` that will be defined, and the table value is the arguments to the |:highlight| command. -| Key | Help | Description | -| ----- | ------------------- | ---------------------------------------------------------- | -| fg | \|highlight-guifg\| | The color value of the foreground of the highlight group | -| bg | \|highlight-guibg\| | The color value of the background of the highlight group | -| sp | \|highlight-guisp\| | The color for underlines and undercurls | -| style | \|highlight-gui\| | The style of the highlight group. Ex `italic`, `bold`, etc | -| link | \|highlight-link\| | Link one `highlight-group` to another | +| Key | Help | Description | +| ----- | ------------------- | ---------------------------------------------------------------------------------------- | +| fg | \|highlight-guifg\| | The color value of the foreground of the highlight group | +| bg | \|highlight-guibg\| | The color value of the background of the highlight group | +| sp | \|highlight-guisp\| | The color for underlines and undercurls | +| blend | \|highlight-blend\| | Override the blend level for a highlight group within the popupmenu or floating windows. | +| style | \|highlight-gui\| | The style of the highlight group. Ex `italic`, `bold`, etc | +| link | \|highlight-link\| | Link one `highlight-group` to another | If the value of `link` is present and is not empty, github theme will link the group to the corresponding value. diff --git a/doc/github-nvim-theme.txt b/doc/github-nvim-theme.txt index d19068bc..df285ef3 100644 --- a/doc/github-nvim-theme.txt +++ b/doc/github-nvim-theme.txt @@ -449,9 +449,9 @@ A `group` is the definition of a `highlight-group`. The key of the group table is the `highlight-group` that will be defined, and the table value is the arguments to the |:highlight| command. - ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------------- Key Help Description - ------- ------------------- -------------------------------------------------- + ------- ------------------- ------------------------------------------------------- fg |highlight-guifg| The color value of the foreground of the highlight group @@ -460,11 +460,13 @@ arguments to the |:highlight| command. sp |highlight-guisp| The color for underlines and undercurls - style |highlight-gui| The style of the highlight group. Ex italic, bold, - etc + blend |highlight-blend| Override the blend level for a highlight group within + the popupmenu or floating windows. + + style |highlight-gui| The style of the highlight group. Ex italic, bold, etc link |highlight-link| Link one highlight-group to another - ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------------- If the value of `link` is present and is not empty, github theme will link the group to the corresponding value. diff --git a/lua/github-theme/lib/compiler.lua b/lua/github-theme/lib/compiler.lua index 03d303fc..200dc8d0 100644 --- a/lua/github-theme/lib/compiler.lua +++ b/lua/github-theme/lib/compiler.lua @@ -59,6 +59,7 @@ vim.o.background = "%s" op.bg = values.bg op.fg = values.fg op.sp = values.sp + op.blend = values.blend table.insert(lines, fmt([[h(0, "%s", %s)]], name, inspect(op))) end end diff --git a/lua/github-theme/util/template.lua b/lua/github-theme/util/template.lua index 49ec0524..bd0d74bd 100644 --- a/lua/github-theme/util/template.lua +++ b/lua/github-theme/util/template.lua @@ -37,7 +37,11 @@ function M.parse(template, spec) if type(opts) == 'table' then local new = {} for key, value in pairs(opts) do - new[key] = parse_string(value, spec) + if type(value) == 'string' then + new[key] = parse_string(value, spec) + elseif type(value) == 'number' then + new[key] = value + end end result[group] = new else