Skip to content

Commit

Permalink
breaking-change: styles configs has been migrated to options.styles
Browse files Browse the repository at this point in the history
Please refer to ':h github-theme.changelog-12042023' for more
information.

Here's an overview of the configuration migration:
  - comment_style  -> options.styles.comments
  - function_style -> options.styles.functions
  - keyword_style  -> options.styles.keywords
  - variable_style -> options.styles.variables
  - msg_area_style -> Removed.
  • Loading branch information
ful1e5 committed Apr 12, 2023
1 parent 87315bc commit a5f6d56
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 30 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The `config.apply_configuration()` function is also deprecated.
- The `theme_style` option is removed. Use `:colorscheme` command instead.
- The module `plugins.lualine` moved to `util.lualine` and `plugins` module removed.
- Config Updates
- `msg_area_style` -> Removed.
- `comment_style` -> `options.styles.comments`
- `function_style` -> `options.styles.functions`
- `keyword_style` -> `options.styles.keywords`
- `variable_style` -> `options.styles.variables`

### What's New?

Expand Down
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,27 @@ vim.cmd('colorscheme github_dark')
| Option | Default | Description |
| ------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| colors | `{}` | You can override specific color groups to use other groups or a hex color |
| comment_style | `italic` | Highlight style for comments (check `:help highlight-args` for options) |
| options.styles.comments | `italic` | Highlight style for comments (check `:help highlight-args` for options) |
| options.styles.functions | `NONE` | Highlight style for functions (check `:help highlight-args` for options) |
| options.styles.keywords | `italic` | Highlight style for keywords (check `:help highlight-args` for options) |
| options.styles.variables | `NONE` | Highlight style for variables and identifiers (check `:help highlight-args` for options) |
| dark_float | `false` | Float windows like the lsp diagnostics windows get a darker background. |
| dark_sidebar | `true` | Sidebar like windows like `NvimTree` get a darker background |
| dev | `false` | Developer Mode. |
| function_style | `NONE` | Highlight style for functions (check `:help highlight-args` for options) |
| hide_end_of_buffer | `true` | Enabling this option, will hide filler lines (~) after the end of the buffer |
| hide_inactive_statusline | `true` | Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine**. |
| keyword_style | `italic` | Highlight style for keywords (check `:help highlight-args` for options) |
| msg_area_style | `NONE` | Highlight style for messages and cmdline (check `:help highlight-args` for options) |
| overrides | `function` | Override specific highlight groups. The function accpet colors as argument. You can also add a non-exists highlight by enabling the `dev` mode. |
| sidebars | `{}` | Set a darker background on sidebar-like windows. For example: `{"qf", "vista_kind", "terminal", "packer"}` |
| transparent | `false` | Enable this to disable setting the background color |
| variable_style | `NONE` | Highlight style for variables and identifiers (check `:help highlight-args` for options) |
| dev | `false` | Developer Mode. |

```lua
-- Example config in Lua
require("github-theme").setup({
function_style = "italic",
options = {
styles = {
functions = "italic",
}
},
sidebars = {"qf", "vista_kind", "terminal", "packer"},

-- Change the "hint" color to the "orange" color, and make the "error" color bright red
Expand Down Expand Up @@ -294,11 +297,15 @@ vim.cmd('colorscheme github_light_colorblind')

```lua
require("github-theme").setup({
comment_style = "NONE",
keyword_style = "NONE",
function_style = "NONE",
variable_style = "NONE"
-- other config
options = {
styles = {
comments = "NONE",
functions = "NONE",
keywords = "NONE",
variables = "NONE"
}
},
-- ...
})
```

Expand All @@ -308,11 +315,15 @@ require("github-theme").setup({

```lua
require("github-theme").setup({
comment_style = "italic",
keyword_style = "italic",
function_style = "italic",
variable_style = "italic"
-- other config
options = {
styles = {
comments = "Italic",
functions = "Italic",
keywords = "Italic",
variables = "Italic"
}
},
-- ...
})
```

Expand Down
13 changes: 13 additions & 0 deletions doc/gt_changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@

# Changelog

*github-theme.changelog-12042023*
Date: April 12, 2023

The configuration for defining styles has been migrated to *options.styles*. As
part of this migration, *msg_area_style* has been removed.

Here is the updated config keys:
- |comment_style| -> |options.styles.comments|
- |function_style| -> |options.styles.functions|
- |keyword_style| -> |options.styles.keywords|
- |variable_style| -> |options.styles.variables|
- |msg_area_style| -> Removed.

*github-theme.changelog-11042023*
Date: April 11, 2023

Expand Down
6 changes: 6 additions & 0 deletions doc/gt_deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Deprecated features
SETUP OPTIONS
- *'theme_style'* Removed. Use 'colorscheme'
command to set colorscheme. Refer `':h github-theme.changelog-11042023'`
- *'comment_style'* Deprecated. Use |'options.styles.comments'| Instead.
- *'function_style'* Deprecated. Use |'options.styles.functions'| Instead.
- *'keyword_style'* Deprecated. Use |'options.styles.keywords'| Instead.
- *'variable_style'* Deprecated. Use |'options.styles.variables'| Instead.
- *'msg_area_style'* Removed. Refer to `'github-theme.changelog-12042023'`


GLOBAL OPTIONS
- *'vim.g.github_theme_style'* Use |setup| Lua function instead.
Expand Down
12 changes: 7 additions & 5 deletions lua/github-theme/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ local collect = require('github-theme.lib.collect')
local M = { theme = 'github_dark', has_options = true }

local defaults = {
styles = {
comments = 'Italic',
functions = 'NONE',
keywords = 'Italic',
variables = 'NONE',
},

hide_end_of_buffer = true,
hide_inactive_statusline = true,
comment_style = 'italic',
function_style = 'NONE',
keyword_style = 'Italic',
msg_area_style = 'NONE',
variable_style = 'NONE',
transparent = false,
dark_float = false,
dark_sidebar = true,
Expand Down
6 changes: 6 additions & 0 deletions lua/github-theme/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ end
M.setup = function(opts)
did_setup = true

-- TODO: Remove this condition when migration
-- from old config to 'opts.options' has been DONE.
if opts then
config.set_options(opts)
end

if opts.options then
config.set_options(opts.options)
end

dep.check_deprecation(opts)
end

Expand Down
16 changes: 8 additions & 8 deletions lua/github-theme/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ M.setup = function()
CursorLineNr = { fg = c.cursor_line_nr }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
MatchParen = { fg = c.fg, bg = c.syntax.match_paren_bg }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
ModeMsg = { fg = c.fg, style = Styles.Bold }, -- 'showmode' message (e.g., "-- INSERT -- ")
MsgArea = { fg = c.fg, style = config.options.msg_area_style }, -- Area for messages and cmdline
MsgArea = { fg = c.fg }, -- Area for messages and cmdline
-- MsgSeparator= { }, -- Separator for scrolled messages, `msgsep` flag of 'display'
MoreMsg = { fg = c.blue }, -- |more-prompt|
NonText = { fg = c.eob }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|.
Expand Down Expand Up @@ -85,22 +85,22 @@ M.setup = function()
-- default,
-- Uncomment and edit if you want more specific syntax highlighting.

Comment = { fg = c.syntax.comment, style = config.options.comment_style }, -- any comment
Comment = { fg = c.syntax.comment, style = config.options.styles.comments }, -- any comment
Constant = { fg = c.syntax.constant }, -- (preferred) any constant
String = { fg = c.syntax.string }, -- a string constant: "this is a string"
Character = { fg = c.syntax.variable }, -- a character constant: 'c', '\n'
-- Number = { }, -- a number constant: 234, 0xff
-- Boolean = { }, -- a boolean constant: TRUE, false
-- Float = { }, -- a floating point constant: 2.3e10

Identifier = { fg = c.syntax.variable, style = config.options.variable_style }, -- (preferred) any variable name
Function = { fg = c.syntax.func, style = config.options.function_style }, -- function name (also: methods for classes)
Identifier = { fg = c.syntax.variable, style = config.options.styles.variables }, -- (preferred) any variable name
Function = { fg = c.syntax.func, style = config.options.styles.functions }, -- function name (also: methods for classes)
Statement = { fg = c.syntax.keyword }, -- (preferred) any statement
-- Conditional = { }, -- if, then, else, endif, switch, etc.
-- Repeat = { }, -- for, do, while, etc.
-- Label = { }, -- case, default, etc.
Operator = { fg = c.syntax.keyword }, -- "sizeof", "+", "*", etc.
Keyword = { fg = c.syntax.keyword, style = config.options.keyword_style }, -- any other keyword
Keyword = { fg = c.syntax.keyword, style = config.options.styles.keywords }, -- any other keyword
-- Exception = { }, -- try, catch, throw

PreProc = { fg = c.syntax.keyword }, -- (preferred) generic Preprocessor
Expand Down Expand Up @@ -223,10 +223,10 @@ M.setup = function()
-- TSFuncBuiltin = { }; -- For builtin functions: `table.insert` in Lua.
-- TSFuncMacro = { }; -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
['@include'] = { fg = c.syntax.keyword }, -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
['@keyword'] = { fg = c.syntax.keyword, style = config.options.keyword_style }, -- For keywords that don't fall in previous categories.
['@keyword'] = { fg = c.syntax.keyword, style = config.options.styles.keywords }, -- For keywords that don't fall in previous categories.
['@keyword.function'] = {
fg = c.syntax.keyword,
style = config.options.function_style,
style = config.options.styles.functions,
}, -- For keywords used to define a fuction.
['@label'] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua.
-- TSMethod = { }; -- For method calls and definitions.
Expand All @@ -247,7 +247,7 @@ M.setup = function()
-- TSSymbol = { }; -- For identifiers referring to symbols or atoms.
['@type'] = { fg = c.syntax.keyword }, -- For types.
-- TSTypeBuiltin = { }; -- For builtin types.
['@variable'] = { fg = c.syntax.variable, style = config.options.variable_style }, -- Any variable name that does not have another highlight.
['@variable'] = { fg = c.syntax.variable, style = config.options.styles.variables }, -- Any variable name that does not have another highlight.
['@variable.builtin'] = { fg = c.syntax.variable }, -- Variable names that are defined by the languages, like `this` or `self`.
['@tag'] = { fg = c.syntax.tag }, -- Tags like html tag names.
['@tag.delimiter'] = { fg = c.fg }, -- Tag delimiter like `<` `>` `/`
Expand Down
44 changes: 44 additions & 0 deletions lua/github-theme/util/deprecation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,50 @@ M.check_deprecation = function(opts)
' for more info.'
)
end

local function check_opt(name, o)
if opts[name] then
local replace = o and o.replace or string.format('options.%s', name)
local help = o and o.help or 'github-theme.changelogs'
dep.write(
' ',
{ name, 'WarningMsg' },
' has been replaced by ',
{ replace, 'WarningMsg' },
'. See ',
{ ':h ' .. help, 'WarningMsg' },
' for more info.'
)
end
end

check_opt(
'comment_style',
{ replace = 'options.styles.comments', help = 'github-theme.changelog-12042023' }
)
check_opt(
'function_style',
{ replace = 'options.styles.functions', help = 'github-theme.changelog-12042023' }
)
check_opt(
'keyword_style',
{ replace = 'options.styles.keywords', help = 'github-theme.changelog-12042023' }
)
check_opt(
'variable_style',
{ replace = 'options.styles.variables', help = 'github-theme.changelog-12042023' }
)

if opts.msg_area_style then
dep.write(
' ',
{ 'msg_area_style', 'WarningMsg' },
' has been removed. Refer to',
{ ' :h github-theme.changelog-12042023', 'WarningMsg' },
' for more info.'
)
end

M.checked_deprecation = true
end

Expand Down

0 comments on commit a5f6d56

Please sign in to comment.