Add support for 'none' class

This commit is contained in:
Olivier Roques
2020-12-25 15:10:17 +01:00
parent 184eecba87
commit 79f6c5bc0f
3 changed files with 78 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ local M = {}
-------------------- OPTIONS -------------------------------
M.options = {
theme = 'one',
theme = 'default',
sections = {
{class = 'mode', item = require('hardline.parts.mode').get_item},
{class = 'high', item = require('hardline.parts.git').get_item},
@@ -36,7 +36,7 @@ local function get_state(class)
end
local function color_item(class, item)
if not class then return item end
if not class or class == 'none' then return item end
local state = get_state(class)
local hlgroup = string.format('Hardline_%s_%s', class, state)
if fn.hlexists(hlgroup) == 0 then return item end

View File

@@ -6,5 +6,5 @@ local function get_item()
end
return {
get_item = get_item(),
get_item = get_item,
}

View File

@@ -1,29 +1,89 @@
local colors = {
red = {gui = '#E06C75', cterm = '204', cterm16 = '1'},
green = {gui = '#98C379', cterm = '114', cterm16 = '2'},
yellow = {gui = '#E5C07B', cterm = '180', cterm16 = '3'},
blue = {gui = '#61AFEF', cterm = '39', cterm16 = '4'},
purple = {gui = '#C678DD', cterm = '170', cterm16 = '5'},
white = {gui = '#ABB2BF', cterm = '145', cterm16 = '7'},
black = {gui = '#282C34', cterm = '235', cterm16 = '0'},
comment_grey = {gui = "#5C6370", cterm = "59", cterm16 = "15"},
cursor_grey = {gui = "#2C323C", cterm = "236", cterm16 = "8"},
menu_grey = {gui = "#3E4452", cterm = "237", cterm16 = "8"},
}
local inactive = {
guifg = colors.comment_grey.gui,
guibg = colors.cursor_grey.gui,
ctermfg = colors.comment_grey.cterm,
ctermbg = colors.cursor_grey.cterm,
}
return {
mode = {
inactive = {ctermfg='170',guifg='#C678DD'},
normal = {ctermfg='170',guifg='#C678DD'},
insert = {ctermfg='170',guifg='#C678DD'},
replace = {ctermfg='170',guifg='#C678DD'},
visual = {ctermfg='170',guifg='#C678DD'},
inactive = inactive,
normal = {
guifg = colors.black.gui,
guibg = colors.green.gui,
ctermfg = colors.black.cterm,
ctermbg = colors.green.cterm,
},
insert = {
guifg = colors.black.gui,
guibg = colors.blue.gui,
ctermfg = colors.black.cterm,
ctermbg = colors.blue.cterm,
},
replace = {
guifg = colors.black.gui,
guibg = colors.red.gui,
ctermfg = colors.black.cterm,
ctermbg = colors.red.cterm,
},
visual = {
guifg = colors.black.gui,
guibg = colors.purple.gui,
ctermfg = colors.black.cterm,
ctermbg = colors.purple.cterm,
},
},
low = {
active = {ctermfg='170',guifg='#C678DD'},
inactive = {ctermfg='172',guifg='#C6080D'},
active = inactive,
inactive = inactive,
},
med = {
active = {ctermfg='170',guifg='#C678DD'},
inactive = {ctermfg='172',guifg='#C6080D'},
active = {
guifg = colors.white.gui,
guibg = colors.cursor_grey.gui,
ctermfg = colors.white.cterm,
ctermbg = colors.cursor_grey.cterm,
},
inactive = inactive,
},
high = {
active = {ctermfg='170',guifg='#C678DD'},
inactive = {ctermfg='172',guifg='#C6080D'},
active = {
guifg = colors.white.gui,
guibg = colors.menu_grey.gui,
ctermfg = colors.white.cterm,
ctermbg = colors.menu_grey.cterm,
},
inactive = inactive,
},
error = {
active = {ctermfg='170',guifg='#C678DD'},
inactive = {ctermfg='172',guifg='#C6080D'},
active = {
guifg = colors.black.gui,
guibg = colors.red.gui,
ctermfg = colors.black.cterm,
ctermbg = colors.red.cterm,
},
inactive = inactive,
},
warning = {
active = {ctermfg='170',guifg='#C678DD'},
inactive = {ctermfg='172',guifg='#C6080D'},
active = {
guifg = colors.black.gui,
guibg = colors.yellow.gui,
ctermfg = colors.black.cterm,
ctermbg = colors.yellow.cterm,
},
inactive = inactive,
},
}