Skip to content

Commit 5d2fc75

Browse files
committed
fix(lualine): make lualine work again with just tokyonight. Fixes #551
1 parent 0717599 commit 5d2fc75

File tree

6 files changed

+61
-70
lines changed

6 files changed

+61
-70
lines changed

lua/lualine/themes/_tokyonight.lua

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
local M = {}
2+
3+
---@param style? string
4+
function M.get(style)
5+
local colors, config = require("tokyonight.colors").setup({
6+
style = style,
7+
})
8+
9+
local hl = {}
10+
11+
hl.normal = {
12+
a = { bg = colors.blue, fg = colors.black },
13+
b = { bg = colors.fg_gutter, fg = colors.blue },
14+
c = { bg = colors.bg_statusline, fg = colors.fg_sidebar },
15+
}
16+
17+
hl.insert = {
18+
a = { bg = colors.green, fg = colors.black },
19+
b = { bg = colors.fg_gutter, fg = colors.green },
20+
}
21+
22+
hl.command = {
23+
a = { bg = colors.yellow, fg = colors.black },
24+
b = { bg = colors.fg_gutter, fg = colors.yellow },
25+
}
26+
27+
hl.visual = {
28+
a = { bg = colors.magenta, fg = colors.black },
29+
b = { bg = colors.fg_gutter, fg = colors.magenta },
30+
}
31+
32+
hl.replace = {
33+
a = { bg = colors.red, fg = colors.black },
34+
b = { bg = colors.fg_gutter, fg = colors.red },
35+
}
36+
37+
hl.terminal = {
38+
a = { bg = colors.green1, fg = colors.black },
39+
b = { bg = colors.fg_gutter, fg = colors.green1 },
40+
}
41+
42+
hl.inactive = {
43+
a = { bg = colors.bg_statusline, fg = colors.blue },
44+
b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" },
45+
c = { bg = colors.bg_statusline, fg = colors.fg_gutter },
46+
}
47+
48+
if config.lualine_bold then
49+
for _, mode in pairs(hl) do
50+
mode.a.gui = "bold"
51+
end
52+
end
53+
return hl
54+
end
55+
56+
return M

lua/lualine/themes/tokyonight-day.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return require("lualine.themes.tokyonight")("day")
1+
return require("lualine.themes._tokyonight").get("day")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return require("lualine.themes.tokyonight")("moon")
1+
return require("lualine.themes._tokyonight").get("moon")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return require("lualine.themes.tokyonight")("night")
1+
return require("lualine.themes._tokyonight").get("night")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return require("lualine.themes.tokyonight")("storm")
1+
return require("lualine.themes._tokyonight").get("storm")

lua/lualine/themes/tokyonight.lua

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1 @@
1-
local M = {}
2-
3-
---@param style? string
4-
function M.get(style)
5-
local colors, config = require("tokyonight.colors").setup({
6-
style = style,
7-
})
8-
9-
local hl = {}
10-
11-
hl.normal = {
12-
a = { bg = colors.blue, fg = colors.black },
13-
b = { bg = colors.fg_gutter, fg = colors.blue },
14-
c = { bg = colors.bg_statusline, fg = colors.fg_sidebar },
15-
}
16-
17-
hl.insert = {
18-
a = { bg = colors.green, fg = colors.black },
19-
b = { bg = colors.fg_gutter, fg = colors.green },
20-
}
21-
22-
hl.command = {
23-
a = { bg = colors.yellow, fg = colors.black },
24-
b = { bg = colors.fg_gutter, fg = colors.yellow },
25-
}
26-
27-
hl.visual = {
28-
a = { bg = colors.magenta, fg = colors.black },
29-
b = { bg = colors.fg_gutter, fg = colors.magenta },
30-
}
31-
32-
hl.replace = {
33-
a = { bg = colors.red, fg = colors.black },
34-
b = { bg = colors.fg_gutter, fg = colors.red },
35-
}
36-
37-
hl.terminal = {
38-
a = { bg = colors.green1, fg = colors.black },
39-
b = { bg = colors.fg_gutter, fg = colors.green1 },
40-
}
41-
42-
hl.inactive = {
43-
a = { bg = colors.bg_statusline, fg = colors.blue },
44-
b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" },
45-
c = { bg = colors.bg_statusline, fg = colors.fg_gutter },
46-
}
47-
48-
if config.lualine_bold then
49-
for _, mode in pairs(hl) do
50-
mode.a.gui = "bold"
51-
end
52-
end
53-
return hl
54-
end
55-
56-
local default
57-
58-
return setmetatable({}, {
59-
__index = function(_, k)
60-
default = default or M.get()
61-
return default[k]
62-
end,
63-
__call = function(_, style)
64-
return M.get(style)
65-
end,
66-
})
1+
return require("lualine.themes._tokyonight").get()

0 commit comments

Comments
 (0)