Skip to content

Commit ea0c562

Browse files
committed
feat: reuse common color in palettes
1 parent ab522a8 commit ea0c562

File tree

8 files changed

+449
-412
lines changed

8 files changed

+449
-412
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
- feat: Apply highlight's style using `types.HighlightStyle` type
3232
- refactor: color name changed 'term_fg' -> 'fg_term'
3333
- feat: suggest config in `vim.g` autocompletion
34+
- feat: reuse common color in palettes
3435

3536
### Fixes
3637

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ src = lua/github-theme
44

55
terminal: $(src)/terminal
66
@lua $(src)/terminal/init.lua
7-
7+
88
fmt:
99
stylua --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
1010

lua/github-theme/palette.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ palette.get_palette = function(theme_style)
77
---@type gt.ColorPalette
88
local p
99

10-
p = require('github-theme.palette.' .. theme_style)
10+
p = require('github-theme.palette.' .. theme_style)()
1111
p.none = 'NONE'
1212
p.dev_icons = {
1313
blue = '#519aba',

lua/github-theme/palette/dark.lua

+86-82
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,95 @@
1-
---@type gt.ColorPalette
2-
return {
3-
-- Background Colors
4-
bg = '#24292e',
5-
bg2 = '#1f2428',
1+
return function()
2+
---@type gt.ColorPalette
3+
local palette = {
4+
-- Background Colors
5+
bg = '#24292e',
6+
bg2 = '#1f2428',
67

7-
-- Foreground Colors
8-
fg = '#c9d1d9',
9-
fg_dark = '#666666',
10-
fg_gutter = '#e1e4e8',
11-
fg_light = '#d1d5da',
12-
fg_term = '#d1d5da',
8+
-- Foreground Colors
9+
fg = '#c9d1d9',
10+
fg_dark = '#666666',
11+
fg_gutter = '#e1e4e8',
12+
fg_light = '#d1d5da',
13+
fg_term = '#d1d5da',
1314

14-
-- Background Highlights Colors
15-
bg_highlight = '#2c313a',
16-
bg_search = '#404030',
17-
bg_visual = '#444c56',
18-
bg_visual_selection = '#284566',
19-
border = '#c9d1d9',
15+
-- Background Highlights Colors
16+
bg_highlight = '#2c313a',
17+
bg_search = '#404030',
18+
bg_visual = '#444c56',
19+
bg_visual_selection = '#284566',
20+
border = '#c9d1d9',
2021

21-
-- Cursor & LineNumber Colors
22-
cursor = '#c8e1ff',
23-
cursor_line_nr = '#e1e4e8',
24-
line_nr = '#444d56',
22+
-- Cursor & LineNumber Colors
23+
cursor = '#c8e1ff',
24+
cursor_line_nr = '#e1e4e8',
25+
line_nr = '#444d56',
2526

26-
-- LSP & Diagnostic Colors
27-
error = '#f97583',
28-
warning = '#cca700',
29-
info = '#75beff',
30-
hint = '#eeeeb3',
31-
lsp = { ref_txt = '#265459' },
27+
-- LSP & Diagnostic Colors
28+
error = '#f97583',
29+
warning = '#cca700',
30+
info = '#75beff',
31+
hint = '#eeeeb3',
32+
lsp = { ref_txt = '#265459' },
3233

33-
-- Auto-Complication Colors
34-
pmenu = { bg = '#1f2428', sbar = '#32383e' },
34+
-- Auto-Complication Colors
35+
pmenu = { bg = '#1f2428', sbar = '#32383e' },
3536

36-
-- Git & Diff Colors
37-
git = {
38-
add = '#34d058',
39-
change = '#e2c08d',
40-
delete = '#ea4a5a',
41-
conflict = '#ffab70',
42-
ignore = '#6a737d',
43-
renamed = '#73c991',
44-
},
45-
diff = {
46-
add = '#244032',
47-
add_fg = '#56d364',
48-
change = '#341a00',
49-
change_fg = '#e3b341',
50-
delete = '#462c32',
51-
delete_fg = '#f85149',
52-
},
37+
-- Git & Diff Colors
38+
git = {
39+
add = '#34d058',
40+
change = '#e2c08d',
41+
delete = '#ea4a5a',
42+
conflict = '#ffab70',
43+
ignore = '#6a737d',
44+
renamed = '#73c991',
45+
},
46+
diff = {
47+
add = '#244032',
48+
add_fg = '#56d364',
49+
change = '#341a00',
50+
change_fg = '#e3b341',
51+
delete = '#462c32',
52+
delete_fg = '#f85149',
53+
},
5354

54-
-- Syntax Colors
55-
syntax = {
56-
comment = '#6a737d',
57-
constant = '#79b8ff',
58-
string = '#9ecbff',
59-
variable = '#79b8ff',
60-
keyword = '#f97583',
61-
func = '#b392f0',
62-
func_param = '#e1e4e8',
63-
match_paren_bg = '#25686c',
64-
tag = '#85e89d',
65-
html_arg = '#fdaeb7',
66-
param = '#ffab70',
67-
json_label = '#79b8ff',
68-
},
55+
-- Syntax Colors
56+
syntax = {
57+
comment = '#6a737d',
58+
constant = '#79b8ff',
59+
string = '#9ecbff',
60+
variable = '#79b8ff',
61+
keyword = '#f97583',
62+
func = '#b392f0',
63+
func_param = '#e1e4e8',
64+
match_paren_bg = '#25686c',
65+
tag = '#85e89d',
66+
html_arg = '#fdaeb7',
67+
param = '#ffab70',
68+
json_label = '#79b8ff',
69+
},
6970

70-
-- Terminal Colors
71-
orange = '#d18616',
72-
black = '#24292e',
73-
bright_black = '#666666',
74-
white = '#b1bac4',
75-
bright_white = '#e5e5e5',
76-
red = '#f14c4c',
77-
bright_red = '#f14c4c',
78-
green = '#23d18b',
79-
bright_green = '#23d18b',
80-
yellow = '#e2e210',
81-
bright_yellow = '#f5f543',
82-
blue = '#3b8eea',
83-
bright_blue = '#3b8eea',
84-
magenta = '#bc3fbc',
85-
bright_magenta = '#d670d6',
86-
cyan = '#29b7da',
87-
bright_cyan = '#29b8db',
71+
-- Terminal Colors
72+
orange = '#d18616',
73+
black = '#24292e',
74+
bright_black = '#666666',
75+
white = '#b1bac4',
76+
bright_white = '#e5e5e5',
77+
red = '#f14c4c',
78+
bright_red = '#f14c4c',
79+
green = '#23d18b',
80+
bright_green = '#23d18b',
81+
yellow = '#e2e210',
82+
bright_yellow = '#f5f543',
83+
blue = '#3b8eea',
84+
bright_blue = '#3b8eea',
85+
magenta = '#bc3fbc',
86+
bright_magenta = '#d670d6',
87+
cyan = '#29b7da',
88+
bright_cyan = '#29b8db',
8889

89-
-- Plugin Colors
90-
git_signs = { add = '#28a745', change = '#2188ff', delete = '#ea4a5a' },
91-
}
90+
-- Plugin Colors
91+
git_signs = { add = '#28a745', change = '#2188ff', delete = '#ea4a5a' },
92+
}
93+
94+
return palette
95+
end
+89-82
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,98 @@
1-
---@type gt.ColorPalette
2-
return {
3-
-- Background Colors
4-
bg = '#0d1117',
5-
bg2 = '#090c10',
1+
local util = require('github-theme.util')
2+
local dark_palette = require('github-theme.palette.dark')
63

7-
-- foreground colors
8-
fg = '#c9d1d9',
9-
fg_dark = '#4d5566',
10-
fg_gutter = '#c5c5c5',
11-
fg_light = '#b3b1ad',
12-
fg_term = '#b3b1ad',
4+
return function()
5+
---@type gt.ColorPalette
6+
local palette = {
7+
-- Background Colors
8+
bg = '#0d1117',
9+
bg2 = '#090c10',
1310

14-
-- Background Highlights Colors
15-
bg_highlight = '#161b22',
16-
bg_search = '#2c2b1c',
17-
bg_visual = '#b3b1ad',
18-
bg_visual_selection = '#163356',
19-
border = '#b3b1ad',
11+
-- foreground colors
12+
-- fg = '#c9d1d9',
13+
fg_dark = '#4d5566',
14+
fg_gutter = '#c5c5c5',
15+
fg_light = '#b3b1ad',
16+
fg_term = '#b3b1ad',
2017

21-
-- Cursor & LineNumber Colors
22-
cursor = '#73b7f2',
23-
cursor_line_nr = '#c9d1d9',
24-
line_nr = '#8b949e',
18+
-- Background Highlights Colors
19+
bg_highlight = '#161b22',
20+
bg_search = '#2c2b1c',
21+
bg_visual = '#b3b1ad',
22+
bg_visual_selection = '#163356',
23+
border = '#b3b1ad',
2524

26-
-- LSP & Diagnostic Colors
27-
error = '#f85149',
28-
warning = '#f0883e',
29-
info = '#75beff',
30-
hint = '#eeeeb3',
31-
lsp = { ref_txt = '#164449' },
25+
-- Cursor & LineNumber Colors
26+
cursor = '#73b7f2',
27+
cursor_line_nr = '#c9d1d9',
28+
line_nr = '#8b949e',
3229

33-
-- Auto-Complication Colors
34-
pmenu = { bg = '#161b22', sbar = '#31373d' },
30+
-- LSP & Diagnostic Colors
31+
error = '#f85149',
32+
warning = '#f0883e',
33+
-- info = '#75beff',
34+
-- hint = '#eeeeb3',
35+
lsp = { ref_txt = '#164449' },
3536

36-
-- Git & Diff Colors
37-
git = {
38-
add = '#56d364',
39-
change = '#ac8934',
40-
delete = '#f85149',
41-
conflict = '#e3b341',
42-
ignore = '#484f58',
43-
renamed = '#73c991',
44-
},
45-
diff = {
46-
add = '#244032',
47-
add_fg = '#56d364',
48-
change = '#341a00',
49-
change_fg = '#e3b341',
50-
delete = '#462c32',
51-
delete_fg = '#f85149',
52-
},
37+
-- Auto-Complication Colors
38+
pmenu = { bg = '#161b22', sbar = '#31373d' },
5339

54-
-- Syntax Colors
55-
syntax = {
56-
comment = '#8b949e',
57-
constant = '#79c0ff',
58-
string = '#A5D6FF',
59-
variable = '#FFA657',
60-
keyword = '#ff7b72',
61-
func = '#d2a8ff',
62-
func_param = '#c9d1d9',
63-
match_paren_bg = '#105357',
64-
tag = '#7ee787',
65-
html_arg = '#ff7b72',
66-
param = '#ffa657',
67-
json_label = '#79c0ff',
68-
},
40+
-- Git & Diff Colors
41+
git = {
42+
add = '#56d364',
43+
change = '#ac8934',
44+
delete = '#f85149',
45+
conflict = '#e3b341',
46+
ignore = '#484f58',
47+
-- renamed = '#73c991',
48+
},
49+
-- diff = {
50+
-- add = '#244032',
51+
-- add_fg = '#56d364',
52+
-- change = '#341a00',
53+
-- change_fg = '#e3b341',
54+
-- delete = '#462c32',
55+
-- delete_fg = '#f85149',
56+
-- },
6957

70-
-- Terminal Colors
71-
orange = '#d18616',
72-
black = '#484f58',
73-
bright_black = '#6e7681',
74-
white = '#b1bac4',
75-
bright_white = '#f0f6fc',
76-
red = '#ff7b72',
77-
bright_red = '#ffa198',
78-
green = '#3fb950',
79-
bright_green = '#56d364',
80-
yellow = '#d29922',
81-
bright_yellow = '#e3b341',
82-
blue = '#58a6ff',
83-
bright_blue = '#79c0ff',
84-
magenta = '#bc8cff',
85-
bright_magenta = '#d2a8ff',
86-
cyan = '#39c5cf',
87-
bright_cyan = '#56d4dd',
58+
-- Syntax Colors
59+
syntax = {
60+
comment = '#8b949e',
61+
-- constant = '#79c0ff',
62+
string = '#a5d6ff',
63+
variable = '#ffa657',
64+
keyword = '#ff7b72',
65+
func = '#d2a8ff',
66+
func_param = '#c9d1d9',
67+
match_paren_bg = '#105357',
68+
tag = '#7ee787',
69+
html_arg = '#ff7b72',
70+
param = '#ffa657',
71+
json_label = '#79c0ff',
72+
},
8873

89-
-- Plugin Colors
90-
git_signs = { add = '#196c2e', change = '#9e6a03', delete = '#b62324' },
91-
}
74+
-- Terminal Colors
75+
-- orange = '#d18616',
76+
black = '#484f58',
77+
bright_black = '#6e7681',
78+
-- white = '#b1bac4',
79+
bright_white = '#f0f6fc',
80+
red = '#ff7b72',
81+
bright_red = '#ffa198',
82+
green = '#3fb950',
83+
bright_green = '#56d364',
84+
yellow = '#d29922',
85+
bright_yellow = '#e3b341',
86+
blue = '#58a6ff',
87+
bright_blue = '#79c0ff',
88+
magenta = '#bc8cff',
89+
bright_magenta = '#d2a8ff',
90+
cyan = '#39c5cf',
91+
bright_cyan = '#56d4dd',
92+
93+
-- Plugin Colors
94+
git_signs = { add = '#196c2e', change = '#9e6a03', delete = '#b62324' },
95+
}
96+
97+
return util.color_overrides(dark_palette(), palette)
98+
end

0 commit comments

Comments
 (0)