Skip to content

Commit 09192a2

Browse files
A-Lamiamehalter
andauthored
feat(lualine): add support for lualine automatic theme detection (#165)
Co-authored-by: Micah Halter <micah.halter@gtri.gatech.edu>
1 parent 3d2e2c0 commit 09192a2

6 files changed

Lines changed: 52 additions & 19 deletions

File tree

lua/lualine/themes/_astrotheme.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
local M = {}
2+
3+
function M.get(style)
4+
local config = require("astrotheme").config
5+
if style and config.palette ~= style then config = vim.tbl_deep_extend("force", config, { palette = style }) end
6+
local c = require("astrotheme.lib.util").set_palettes(config)
7+
8+
return {
9+
normal = {
10+
a = { bg = c.ui.blue, fg = c.ui.tabline, gui = "bold" },
11+
b = { bg = c.ui.tabline, fg = c.ui.blue },
12+
c = { bg = c.ui.tabline, fg = c.ui.text_inactive },
13+
},
14+
15+
insert = {
16+
a = { bg = c.ui.green, fg = c.ui.tabline, gui = "bold" },
17+
b = { bg = c.ui.tabline, fg = c.ui.green },
18+
},
19+
20+
command = {
21+
a = { bg = c.ui.yellow, fg = c.ui.tabline, gui = "bold" },
22+
b = { bg = c.ui.tabline, fg = c.ui.yellow },
23+
},
24+
25+
visual = {
26+
a = { bg = c.ui.purple, fg = c.ui.tabline, gui = "bold" },
27+
b = { bg = c.ui.tabline, fg = c.ui.purple },
28+
},
29+
replace = {
30+
a = { bg = c.ui.red, fg = c.ui.tabline, gui = "bold" },
31+
b = { bg = c.ui.tabline, fg = c.ui.red },
32+
},
33+
34+
terminal = {
35+
a = { bg = c.ui.green, fg = c.ui.tabline, gui = "bold" },
36+
b = { bg = c.ui.tabline, fg = c.ui.green },
37+
},
38+
39+
inactive = {
40+
a = { bg = c.ui.tabline, fg = c.ui.blue },
41+
b = { bg = c.ui.tabline, fg = c.ui.tabline, gui = "bold" },
42+
c = { bg = c.ui.tabline, fg = c.ui.tabline },
43+
},
44+
}
45+
end
46+
47+
return M

lua/lualine/themes/astrodark.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return require("lualine.themes._astrotheme").get "astrodark"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return require("lualine.themes._astrotheme").get "astrojupiter"

lua/lualine/themes/astrolight.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return require("lualine.themes._astrotheme").get "astrolight"

lua/lualine/themes/astromars.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return require("lualine.themes._astrotheme").get "astromars"

lua/lualine/themes/astrotheme.lua

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
local c = require("astrotheme.lib.util").set_palettes(require("astrotheme").config)
2-
3-
return {
4-
normal = {
5-
a = { fg = c.ui.base, bg = c.syntax.blue, gui = "bold" },
6-
b = { fg = c.ui.purple, bg = c.ui.statusline },
7-
c = { fg = c.ui.text_active, bg = c.ui.statusline },
8-
},
9-
insert = { a = { fg = c.ui.base, bg = c.ui.green, gui = "bold" } },
10-
visual = { a = { fg = c.ui.base, bg = c.ui.purple, gui = "bold" } },
11-
replace = { a = { fg = c.ui.base, bg = c.ui.red, gui = "bold" } },
12-
command = { a = { fg = c.ui.base, bg = c.ui.yellow, gui = "bold" } },
13-
terminal = { a = { fg = c.ui.base, bg = c.ui.orange, gui = "bold" } },
14-
inactive = {
15-
a = { fg = c.ui.text_inactive, bg = c.ui.base, gui = "bold" },
16-
b = { fg = c.ui.text_inactive, bg = c.ui.base, gui = "bold" },
17-
c = { fg = c.ui.text_inactive, bg = c.ui.base, gui = "bold" },
18-
},
19-
}
1+
return require("lualine.themes._astrotheme").get()

0 commit comments

Comments
 (0)