Skip to content

Commit a5f6d56

Browse files
committed
breaking-change: styles configs has been migrated to options.styles
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.
1 parent 87315bc commit a5f6d56

File tree

8 files changed

+118
-30
lines changed

8 files changed

+118
-30
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- The `config.apply_configuration()` function is also deprecated.
1515
- The `theme_style` option is removed. Use `:colorscheme` command instead.
1616
- The module `plugins.lualine` moved to `util.lualine` and `plugins` module removed.
17+
- Config Updates
18+
- `msg_area_style` -> Removed.
19+
- `comment_style` -> `options.styles.comments`
20+
- `function_style` -> `options.styles.functions`
21+
- `keyword_style` -> `options.styles.keywords`
22+
- `variable_style` -> `options.styles.variables`
1723

1824
### What's New?
1925

README.md

+28-17
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,27 @@ vim.cmd('colorscheme github_dark')
9595
| Option | Default | Description |
9696
| ------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
9797
| colors | `{}` | You can override specific color groups to use other groups or a hex color |
98-
| comment_style | `italic` | Highlight style for comments (check `:help highlight-args` for options) |
98+
| options.styles.comments | `italic` | Highlight style for comments (check `:help highlight-args` for options) |
99+
| options.styles.functions | `NONE` | Highlight style for functions (check `:help highlight-args` for options) |
100+
| options.styles.keywords | `italic` | Highlight style for keywords (check `:help highlight-args` for options) |
101+
| options.styles.variables | `NONE` | Highlight style for variables and identifiers (check `:help highlight-args` for options) |
99102
| dark_float | `false` | Float windows like the lsp diagnostics windows get a darker background. |
100103
| dark_sidebar | `true` | Sidebar like windows like `NvimTree` get a darker background |
101-
| dev | `false` | Developer Mode. |
102-
| function_style | `NONE` | Highlight style for functions (check `:help highlight-args` for options) |
103104
| hide_end_of_buffer | `true` | Enabling this option, will hide filler lines (~) after the end of the buffer |
104105
| 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**. |
105-
| keyword_style | `italic` | Highlight style for keywords (check `:help highlight-args` for options) |
106-
| msg_area_style | `NONE` | Highlight style for messages and cmdline (check `:help highlight-args` for options) |
107106
| 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. |
108107
| sidebars | `{}` | Set a darker background on sidebar-like windows. For example: `{"qf", "vista_kind", "terminal", "packer"}` |
109108
| transparent | `false` | Enable this to disable setting the background color |
110-
| variable_style | `NONE` | Highlight style for variables and identifiers (check `:help highlight-args` for options) |
109+
| dev | `false` | Developer Mode. |
111110

112111
```lua
113112
-- Example config in Lua
114113
require("github-theme").setup({
115-
function_style = "italic",
114+
options = {
115+
styles = {
116+
functions = "italic",
117+
}
118+
},
116119
sidebars = {"qf", "vista_kind", "terminal", "packer"},
117120

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

295298
```lua
296299
require("github-theme").setup({
297-
comment_style = "NONE",
298-
keyword_style = "NONE",
299-
function_style = "NONE",
300-
variable_style = "NONE"
301-
-- other config
300+
options = {
301+
styles = {
302+
comments = "NONE",
303+
functions = "NONE",
304+
keywords = "NONE",
305+
variables = "NONE"
306+
}
307+
},
308+
-- ...
302309
})
303310
```
304311

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

309316
```lua
310317
require("github-theme").setup({
311-
comment_style = "italic",
312-
keyword_style = "italic",
313-
function_style = "italic",
314-
variable_style = "italic"
315-
-- other config
318+
options = {
319+
styles = {
320+
comments = "Italic",
321+
functions = "Italic",
322+
keywords = "Italic",
323+
variables = "Italic"
324+
}
325+
},
326+
-- ...
316327
})
317328
```
318329

doc/gt_changelog.txt

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33

44
# Changelog
55

6+
*github-theme.changelog-12042023*
7+
Date: April 12, 2023
8+
9+
The configuration for defining styles has been migrated to *options.styles*. As
10+
part of this migration, *msg_area_style* has been removed.
11+
12+
Here is the updated config keys:
13+
- |comment_style| -> |options.styles.comments|
14+
- |function_style| -> |options.styles.functions|
15+
- |keyword_style| -> |options.styles.keywords|
16+
- |variable_style| -> |options.styles.variables|
17+
- |msg_area_style| -> Removed.
18+
619
*github-theme.changelog-11042023*
720
Date: April 11, 2023
821

doc/gt_deprecated.txt

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Deprecated features
1313
SETUP OPTIONS
1414
- *'theme_style'* Removed. Use 'colorscheme'
1515
command to set colorscheme. Refer `':h github-theme.changelog-11042023'`
16+
- *'comment_style'* Deprecated. Use |'options.styles.comments'| Instead.
17+
- *'function_style'* Deprecated. Use |'options.styles.functions'| Instead.
18+
- *'keyword_style'* Deprecated. Use |'options.styles.keywords'| Instead.
19+
- *'variable_style'* Deprecated. Use |'options.styles.variables'| Instead.
20+
- *'msg_area_style'* Removed. Refer to `'github-theme.changelog-12042023'`
21+
1622

1723
GLOBAL OPTIONS
1824
- *'vim.g.github_theme_style'* Use |setup| Lua function instead.

lua/github-theme/config.lua

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ local collect = require('github-theme.lib.collect')
33
local M = { theme = 'github_dark', has_options = true }
44

55
local defaults = {
6+
styles = {
7+
comments = 'Italic',
8+
functions = 'NONE',
9+
keywords = 'Italic',
10+
variables = 'NONE',
11+
},
12+
613
hide_end_of_buffer = true,
714
hide_inactive_statusline = true,
8-
comment_style = 'italic',
9-
function_style = 'NONE',
10-
keyword_style = 'Italic',
11-
msg_area_style = 'NONE',
12-
variable_style = 'NONE',
1315
transparent = false,
1416
dark_float = false,
1517
dark_sidebar = true,

lua/github-theme/init.lua

+6
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,16 @@ end
6363
M.setup = function(opts)
6464
did_setup = true
6565

66+
-- TODO: Remove this condition when migration
67+
-- from old config to 'opts.options' has been DONE.
6668
if opts then
6769
config.set_options(opts)
6870
end
6971

72+
if opts.options then
73+
config.set_options(opts.options)
74+
end
75+
7076
dep.check_deprecation(opts)
7177
end
7278

lua/github-theme/theme.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ M.setup = function()
4646
CursorLineNr = { fg = c.cursor_line_nr }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
4747
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|
4848
ModeMsg = { fg = c.fg, style = Styles.Bold }, -- 'showmode' message (e.g., "-- INSERT -- ")
49-
MsgArea = { fg = c.fg, style = config.options.msg_area_style }, -- Area for messages and cmdline
49+
MsgArea = { fg = c.fg }, -- Area for messages and cmdline
5050
-- MsgSeparator= { }, -- Separator for scrolled messages, `msgsep` flag of 'display'
5151
MoreMsg = { fg = c.blue }, -- |more-prompt|
5252
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|.
@@ -85,22 +85,22 @@ M.setup = function()
8585
-- default,
8686
-- Uncomment and edit if you want more specific syntax highlighting.
8787

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

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

106106
PreProc = { fg = c.syntax.keyword }, -- (preferred) generic Preprocessor
@@ -223,10 +223,10 @@ M.setup = function()
223223
-- TSFuncBuiltin = { }; -- For builtin functions: `table.insert` in Lua.
224224
-- TSFuncMacro = { }; -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
225225
['@include'] = { fg = c.syntax.keyword }, -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
226-
['@keyword'] = { fg = c.syntax.keyword, style = config.options.keyword_style }, -- For keywords that don't fall in previous categories.
226+
['@keyword'] = { fg = c.syntax.keyword, style = config.options.styles.keywords }, -- For keywords that don't fall in previous categories.
227227
['@keyword.function'] = {
228228
fg = c.syntax.keyword,
229-
style = config.options.function_style,
229+
style = config.options.styles.functions,
230230
}, -- For keywords used to define a fuction.
231231
['@label'] = { fg = c.blue }, -- For labels: `label:` in C and `:label:` in Lua.
232232
-- TSMethod = { }; -- For method calls and definitions.
@@ -247,7 +247,7 @@ M.setup = function()
247247
-- TSSymbol = { }; -- For identifiers referring to symbols or atoms.
248248
['@type'] = { fg = c.syntax.keyword }, -- For types.
249249
-- TSTypeBuiltin = { }; -- For builtin types.
250-
['@variable'] = { fg = c.syntax.variable, style = config.options.variable_style }, -- Any variable name that does not have another highlight.
250+
['@variable'] = { fg = c.syntax.variable, style = config.options.styles.variables }, -- Any variable name that does not have another highlight.
251251
['@variable.builtin'] = { fg = c.syntax.variable }, -- Variable names that are defined by the languages, like `this` or `self`.
252252
['@tag'] = { fg = c.syntax.tag }, -- Tags like html tag names.
253253
['@tag.delimiter'] = { fg = c.fg }, -- Tag delimiter like `<` `>` `/`

lua/github-theme/util/deprecation.lua

+44
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,50 @@ M.check_deprecation = function(opts)
5959
' for more info.'
6060
)
6161
end
62+
63+
local function check_opt(name, o)
64+
if opts[name] then
65+
local replace = o and o.replace or string.format('options.%s', name)
66+
local help = o and o.help or 'github-theme.changelogs'
67+
dep.write(
68+
' ',
69+
{ name, 'WarningMsg' },
70+
' has been replaced by ',
71+
{ replace, 'WarningMsg' },
72+
'. See ',
73+
{ ':h ' .. help, 'WarningMsg' },
74+
' for more info.'
75+
)
76+
end
77+
end
78+
79+
check_opt(
80+
'comment_style',
81+
{ replace = 'options.styles.comments', help = 'github-theme.changelog-12042023' }
82+
)
83+
check_opt(
84+
'function_style',
85+
{ replace = 'options.styles.functions', help = 'github-theme.changelog-12042023' }
86+
)
87+
check_opt(
88+
'keyword_style',
89+
{ replace = 'options.styles.keywords', help = 'github-theme.changelog-12042023' }
90+
)
91+
check_opt(
92+
'variable_style',
93+
{ replace = 'options.styles.variables', help = 'github-theme.changelog-12042023' }
94+
)
95+
96+
if opts.msg_area_style then
97+
dep.write(
98+
' ',
99+
{ 'msg_area_style', 'WarningMsg' },
100+
' has been removed. Refer to',
101+
{ ' :h github-theme.changelog-12042023', 'WarningMsg' },
102+
' for more info.'
103+
)
104+
end
105+
62106
M.checked_deprecation = true
63107
end
64108

0 commit comments

Comments
 (0)