Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to change lualine highlights #184

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ require('onedark').setup {
-- Lualine options --
lualine = {
transparent = false, -- lualine center bar transparency
highlights = { -- set custom highlights for lualine
inactive = {
a = {}, -- each can accept fb and bg with a color as a string, i.e. bg = "#000000"
b = {},
c = {},
},
normal = {
a = {},
b = {},
c = {},
},
visual = { a = {} },
replace = { a = {} },
insert = { a = {} },
command = { a = {} },
terminal = { a = {} },
},
},

-- Custom Highlights --
Expand Down
81 changes: 67 additions & 14 deletions lua/lualine/themes/onedark.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local c = require('onedark.colors')
local c = require 'onedark.colors'
local cfg = vim.g.onedark_config
local highlights = cfg.lualine.highlights

local colors = {
bg = c.bg0,
fg = c.fg,
Expand All @@ -9,24 +11,75 @@ local colors = {
blue = c.blue,
purple = c.purple,
cyan = c.cyan,
gray = c.grey
gray = c.grey,
}

local one_dark = {
inactive = {
a = {fg = colors.gray, bg = colors.bg, gui = 'bold'},
b = {fg = colors.gray, bg = colors.bg},
c = {fg = colors.gray, bg = cfg.lualine.transparent and c.none or c.bg1},
a = {
fg = highlights.inactive.a.fg or colors.gray,
bg = highlights.inactive.a.bg or colors.bg,
gui = 'bold',
},
b = {
fg = highlights.inactive.b.fg or colors.gray,
bg = highlights.inactive.b.bg or colors.bg,
},
c = {
fg = highlights.inactive.c.fg or colors.white,
bg = cfg.lualine.transparent and c.none or highlights.inactive.c.bg or c.bg1,
},
},
normal = {
a = {fg = colors.bg, bg = colors.green, gui = 'bold'},
b = {fg = colors.fg, bg = c.bg3},
c = {fg = colors.fg, bg = cfg.lualine.transparent and c.none or c.bg1},
a = {
fg = highlights.normal.a.fg or colors.bg,
bg = highlights.normal.a.bg or colors.green,
gui = 'bold',
},
b = {
fg = highlights.normal.b.fg or colors.fg,
bg = highlights.normal.b.bg or c.bg3,
},
c = {
fg = highlights.normal.c.fg or colors.fg,
bg = cfg.lualine.transparent and c.none or highlights.normal.c.bg or c.bg1,
},
},
visual = {
a = {
fg = highlights.visual.a.fg or colors.bg,
bg = highlights.visual.a.bg or colors.purple,
gui = 'bold',
},
},
replace = {
a = {
fg = highlights.replace.a.fg or colors.bg,
bg = highlights.replace.a.bg or colors.red,
gui = 'bold',
},
},
insert = {
a = {
fg = highlights.insert.a.fg or colors.bg,
bg = highlights.insert.a.bg or colors.blue,
gui = 'bold',
},
},
command = {
a = {
fg = highlights.command.a.fg or colors.bg,
bg = highlights.command.a.bg or colors.yellow,
gui = 'bold',
},
},
terminal = {
a = {
fg = highlights.terminal.a.fg or colors.bg,
bg = highlights.terminal.a.bg or colors.cyan,
gui = 'bold',
},
},
visual = {a = {fg = colors.bg, bg = colors.purple, gui = 'bold'}},
replace = {a = {fg = colors.bg, bg = colors.red, gui = 'bold'}},
insert = {a = {fg = colors.bg, bg = colors.blue, gui = 'bold'}},
command = {a = {fg = colors.bg, bg = colors.yellow, gui = 'bold'}},
terminal = {a = {fg = colors.bg, bg = colors.cyan, gui = 'bold'}},
}
return one_dark;

return one_dark
17 changes: 17 additions & 0 deletions lua/onedark/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ local default_config = {
-- Lualine options --
lualine = {
transparent = false, -- center bar (c) transparency
highlights = {
inactive = {
a = {},
b = {},
c = {},
},
normal = {
a = {},
b = {},
c = {},
},
visual = { a = {} },
replace = { a = {} },
insert = { a = {} },
command = { a = {} },
terminal = { a = {} },
}, -- set background color for lualine
},

-- Custom Highlights --
Expand Down