feat(colors|statusline): clean out unneeded color definitions

This commit is contained in:
Matt Leong 2021-12-06 17:25:21 -08:00
parent 33ee1969d1
commit fb7722d56d
11 changed files with 67 additions and 72 deletions

View file

@ -8,6 +8,8 @@ local colors = require('cosmic.theme.colors')
local highlight = require('cosmic.theme.utils').highlight local highlight = require('cosmic.theme.utils').highlight
local icons = require('cosmic.theme.icons') local icons = require('cosmic.theme.icons')
local config = require('cosmic.config') local config = require('cosmic.config')
local get_highlight = require('cosmic.theme.utils').get_highlight
local statusline_colors = get_highlight('StatusLine')
local defaults = vim.tbl_deep_extend('force', { local defaults = vim.tbl_deep_extend('force', {
statusline = { statusline = {
@ -50,7 +52,7 @@ local function get_git_root()
return get_basename(git_root) .. ' ' return get_basename(git_root) .. ' '
end end
local check_width_and_git_and_buffer = function() local check_git_and_buffer = function()
return condition.check_git_workspace() and condition.buffer_not_empty() return condition.check_git_workspace() and condition.buffer_not_empty()
end end
@ -122,31 +124,6 @@ galaxy.short_line_list = {
'fugitiveblame', 'fugitiveblame',
} }
gls.mid = {
{
LSPStatus = {
provider = function()
local clients = utils.get_active_lsp_client_names()
local client_str = ''
if #clients < 1 then
return client_str
end
for i, client in ipairs(clients) do
client_str = client_str .. client
if i < #clients then
client_str = client_str .. ', '
end
end
return 'LSP: [' .. client_str .. ']'
end,
highlight = 'GalaxyText',
},
},
}
gls.left = { gls.left = {
{ {
GhostLeftBracket = { GhostLeftBracket = {
@ -177,10 +154,10 @@ gls.left = {
local label, mode_color, mode_nested = unpack(m) local label, mode_color, mode_nested = unpack(m)
highlight('GalaxyViMode', mode_color, mode_nested) highlight('GalaxyViMode', mode_color, mode_nested)
highlight('GalaxyViModeInv', mode_nested, mode_color) highlight('GalaxyViModeInv', mode_nested, mode_color)
highlight('GalaxyViModeNested', mode_nested, colors.statusline_bg) highlight('GalaxyViModeNested', mode_nested, 'StatusLine')
highlight('GalaxyViModeNestedInv', colors.statusline_bg, mode_nested) highlight('GalaxyViModeNestedInv', 'StatusLine', mode_nested)
highlight('GalaxyPercentBracket', colors.statusline_bg, mode_color) highlight('GalaxyPercentBracket', 'StatusLine', mode_color)
highlight('GalaxyText', colors.statusline_bg, mode_color) highlight('GalaxyText', 'StatusLine', mode_color)
highlight('GalaxyGitLCBracket', mode_nested, mode_color) highlight('GalaxyGitLCBracket', mode_nested, mode_color)
@ -188,9 +165,9 @@ gls.left = {
highlight('GalaxyViModeBracket', mode_nested, mode_color) highlight('GalaxyViModeBracket', mode_nested, mode_color)
else else
if condition.check_git_workspace() then if condition.check_git_workspace() then
highlight('GalaxyGitLCBracket', colors.statusline_bg, mode_color) highlight('GalaxyGitLCBracket', 'StatusLine', mode_color)
end end
highlight('GalaxyViModeBracket', colors.statusline_bg, mode_color) highlight('GalaxyViModeBracket', 'StatusLine', mode_color)
end end
return ' ' .. label .. ' ' return ' ' .. label .. ' '
end, end,
@ -205,7 +182,7 @@ gls.left = {
{ {
GitIcon = { GitIcon = {
provider = BracketProvider(' ' .. icons.branch .. ' ', true), provider = BracketProvider(' ' .. icons.branch .. ' ', true),
condition = check_width_and_git_and_buffer, condition = check_git_and_buffer,
highlight = 'GalaxyViModeInv', highlight = 'GalaxyViModeInv',
}, },
}, },
@ -222,7 +199,7 @@ gls.left = {
end end
return branch_name .. ' ' return branch_name .. ' '
end, end,
condition = check_width_and_git_and_buffer, condition = check_git_and_buffer,
highlight = 'GalaxyViModeInv', highlight = 'GalaxyViModeInv',
separator = icons.arrow_right, separator = icons.arrow_right,
separator_highlight = 'GalaxyViModeInv', separator_highlight = 'GalaxyViModeInv',
@ -262,30 +239,24 @@ gls.left = {
DiffAdd = { DiffAdd = {
provider = 'DiffAdd', provider = 'DiffAdd',
icon = ' ' .. icons.diff_add, icon = ' ' .. icons.diff_add,
condition = check_width_and_git_and_buffer, condition = check_git_and_buffer,
highlight = { colors.diffAdd, colors.statusline_bg }, highlight = { colors.diffAdd, 'StatusLine' },
}, },
}, },
{ {
DiffModified = { DiffModified = {
provider = 'DiffModified', provider = 'DiffModified',
condition = check_width_and_git_and_buffer, condition = check_git_and_buffer,
icon = ' ' .. icons.diff_modified, icon = ' ' .. icons.diff_modified,
highlight = { colors.diffModified, colors.statusline_bg }, highlight = { colors.diffModified, 'StatusLine' },
}, },
}, },
{ {
DiffRemove = { DiffRemove = {
provider = 'DiffRemove', provider = 'DiffRemove',
condition = check_width_and_git_and_buffer, condition = check_git_and_buffer,
icon = ' ' .. icons.diff_remove, icon = ' ' .. icons.diff_remove,
highlight = { colors.diffDeleted, colors.statusline_bg }, highlight = { colors.diffDeleted, 'StatusLine' },
},
},
{
WSpace = {
provider = 'WhiteSpace',
highlight = { colors.statusline_bg, colors.statusline_bg },
}, },
}, },
} }
@ -368,6 +339,40 @@ gls.right = {
highlight = 'GalaxyViModeNestedInv', highlight = 'GalaxyViModeNestedInv',
}, },
}, },
{
LSPStatus = {
provider = function()
local clients = utils.get_active_lsp_client_names()
local client_str = ''
if #clients < 1 then
return client_str
end
for i, client in ipairs(clients) do
client_str = client_str .. client
if i < #clients then
client_str = client_str .. ', '
end
end
if client_str:len() < 1 then
return
end
return ' LSP: [' .. client_str .. ']'
end,
highlight = 'GalaxyViModeInv',
condition = check_buffer_and_width,
},
},
{
LSPStatusArrow = {
provider = BracketProvider(' ' .. icons.arrow_left, true),
highlight = 'GalaxyViModeInv',
condition = check_buffer_and_width,
},
},
{ {
GitRoot = { GitRoot = {
provider = get_git_root, provider = get_git_root,
@ -412,19 +417,19 @@ gls.short_line_left = {
{ {
GhostLeftBracketShort = { GhostLeftBracketShort = {
provider = BracketProvider(icons.rounded_left_filled, true), provider = BracketProvider(icons.rounded_left_filled, true),
highlight = { colors.white, colors.statusline_bg }, highlight = { colors.white, 'StatusLine' },
}, },
}, },
{ {
GhostShort = { GhostShort = {
provider = BracketProvider(main_icon, true), provider = BracketProvider(main_icon, true),
highlight = { colors.statusline_bg, colors.white }, highlight = { 'StatusLine', colors.white },
}, },
}, },
{ {
GhostRightBracketShort = { GhostRightBracketShort = {
provider = BracketProvider(icons.rounded_right_filled, true), provider = BracketProvider(icons.rounded_right_filled, true),
highlight = { colors.white, colors.statusline_bg }, highlight = { colors.white, 'StatusLine' },
}, },
}, },
{ {
@ -440,7 +445,7 @@ gls.short_line_left = {
end, end,
highlight = { highlight = {
require('galaxyline.providers.fileinfo').get_file_icon, require('galaxyline.providers.fileinfo').get_file_icon,
colors.statusline_bg, 'StatusLine',
}, },
}, },
}, },
@ -450,7 +455,7 @@ gls.short_line_left = {
condition = function() condition = function()
return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree' return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree'
end, end,
highlight = { colors.white, colors.statusline_bg }, highlight = { colors.white, 'StatusLine' },
}, },
}, },
{ {
@ -459,7 +464,7 @@ gls.short_line_left = {
condition = function() condition = function()
return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree' return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree'
end, end,
highlight = { colors.white, colors.statusline_bg }, highlight = { colors.white, 'StatusLine' },
}, },
}, },
} }
@ -469,7 +474,7 @@ gls.short_line_right = {
GitRootShortLeftBracket = { GitRootShortLeftBracket = {
provider = BracketProvider(icons.arrow_left_filled, true), provider = BracketProvider(icons.arrow_left_filled, true),
condition = condition.buffer_not_empty, condition = condition.buffer_not_empty,
highlight = { colors.white, colors.statusline_bg }, highlight = { colors.white, 'StatusLine' },
}, },
}, },
{ {
@ -477,14 +482,14 @@ gls.short_line_right = {
provider = get_git_root, provider = get_git_root,
condition = condition.buffer_not_empty, condition = condition.buffer_not_empty,
icon = ' ' .. icons.file .. ' ', icon = ' ' .. icons.file .. ' ',
highlight = { colors.statusline_bg, colors.white }, highlight = { statusline_colors.guibg, colors.white },
}, },
}, },
{ {
GitRootShortRightBracket = { GitRootShortRightBracket = {
provider = BracketProvider(icons.rounded_right_filled, true), provider = BracketProvider(icons.rounded_right_filled, true),
condition = condition.buffer_not_empty, condition = condition.buffer_not_empty,
highlight = { colors.white, colors.statusline_bg }, highlight = { colors.white, 'StatusLine' },
}, },
}, },
} }

View file

@ -6,15 +6,13 @@ local highlight = require('cosmic.theme.utils').highlight
local get_highlight = require('cosmic.theme.utils').get_highlight local get_highlight = require('cosmic.theme.utils').get_highlight
local set_highlight = require('cosmic.theme.utils').set_highlight local set_highlight = require('cosmic.theme.utils').set_highlight
-- @TODO: can i get rid of this? local statusline_colors = get_highlight('StatusLine')
highlight('StatusLine', colors.statusline_bg, colors.statusline_bg)
local error_colors = get_highlight('DiagnosticError') local error_colors = get_highlight('DiagnosticError')
set_highlight( set_highlight(
'DiagnosticErrorInv', 'DiagnosticErrorInv',
vim.tbl_extend('force', error_colors, { vim.tbl_extend('force', error_colors, {
guibg = error_colors.guifg, guibg = error_colors.guifg,
guifg = colors.statusline_bg, guifg = statusline_colors.guibg,
}) })
) )
@ -23,7 +21,7 @@ set_highlight(
'DiagnosticWarnInv', 'DiagnosticWarnInv',
vim.tbl_extend('force', warning_colors, { vim.tbl_extend('force', warning_colors, {
guibg = warning_colors.guifg, guibg = warning_colors.guifg,
guifg = colors.statusline_bg, guifg = statusline_colors.guibg,
}) })
) )
@ -32,7 +30,7 @@ set_highlight(
'DiagnosticHintInv', 'DiagnosticHintInv',
vim.tbl_extend('force', hint_colors, { vim.tbl_extend('force', hint_colors, {
guibg = hint_colors.guifg, guibg = hint_colors.guifg,
guifg = colors.statusline_bg, guifg = statusline_colors.guibg,
}) })
) )
@ -41,7 +39,7 @@ set_highlight(
'DiagnosticInfoInv', 'DiagnosticInfoInv',
vim.tbl_extend('force', info_colors, { vim.tbl_extend('force', info_colors, {
guibg = info_colors.guifg, guibg = info_colors.guifg,
guifg = colors.statusline_bg, guifg = statusline_colors.guibg,
}) })
) )

View file

@ -4,7 +4,6 @@ local colors = {
white = theme.catppuccin0, white = theme.catppuccin0,
bg = theme.catppuccin12, bg = theme.catppuccin12,
bg_highlight = theme.catppuccin15, bg_highlight = theme.catppuccin15,
statusline_bg = theme.catppuccin14,
normal = theme.catppuccin3, normal = theme.catppuccin3,
insert = theme.catppuccin4, insert = theme.catppuccin4,
command = theme.catppuccin5, command = theme.catppuccin5,

View file

@ -31,7 +31,6 @@ local colors = {
white = theme.white, white = theme.white,
bg = theme.nontext, bg = theme.nontext,
bg_highlight = theme.nontext, bg_highlight = theme.nontext,
statusline_bg = theme.bg,
normal = theme.bright_green, normal = theme.bright_green,
insert = theme.bright_cyan, insert = theme.bright_cyan,
command = theme.orange, command = theme.orange,

View file

@ -27,7 +27,6 @@ local colors = {
white = theme.fg_1, white = theme.fg_1,
bg = theme.bg_2, bg = theme.bg_2,
bg_highlight = theme.bg_2, bg_highlight = theme.bg_2,
statusline_bg = theme.bg_1,
normal = theme.green, normal = theme.green,
insert = theme.cyan, insert = theme.cyan,
command = theme.orange, command = theme.orange,

View file

@ -5,7 +5,6 @@ local colors = {
white = convert.hsl_to_hex(theme.light0_hard), white = convert.hsl_to_hex(theme.light0_hard),
bg = convert.hsl_to_hex(theme.dark0), bg = convert.hsl_to_hex(theme.dark0),
bg_highlight = convert.hsl_to_hex(theme.dark1), bg_highlight = convert.hsl_to_hex(theme.dark1),
statusline_bg = convert.hsl_to_hex(theme.dark2),
normal = convert.hsl_to_hex(theme.neutral_yellow), normal = convert.hsl_to_hex(theme.neutral_yellow),
insert = convert.hsl_to_hex(theme.neutral_green), insert = convert.hsl_to_hex(theme.neutral_green),
command = convert.hsl_to_hex(theme.neutral_orange), command = convert.hsl_to_hex(theme.neutral_orange),

View file

@ -5,7 +5,6 @@ local colors = {
white = themeColors.fg_alt, white = themeColors.fg_alt,
bg = themeColors.bg, bg = themeColors.bg,
bg_highlight = themeColors.bg_highlight, bg_highlight = themeColors.bg_highlight,
statusline_bg = themeColors.bg_alt,
normal = themeColors.blue, normal = themeColors.blue,
insert = themeColors.cyan, insert = themeColors.cyan,
command = themeColors.orange, command = themeColors.orange,
@ -24,3 +23,4 @@ local colors = {
} }
return colors return colors

View file

@ -3,7 +3,6 @@ local colors = {
white = theme.nord4_gui, white = theme.nord4_gui,
bg = theme.nord1_gui, bg = theme.nord1_gui,
bg_highlight = theme.nord1_gui, bg_highlight = theme.nord1_gui,
statusline_bg = theme.nord2_gui,
normal = theme.nord9_gui, normal = theme.nord9_gui,
insert = theme.nord14_gui, insert = theme.nord14_gui,
command = theme.nord13_gui, command = theme.nord13_gui,

View file

@ -4,7 +4,6 @@ local colors = {
white = theme.fg, white = theme.fg,
bg = theme.bg3, bg = theme.bg3,
bg_highlight = theme.bg3, bg_highlight = theme.bg3,
statusline_bg = theme.bg0,
normal = theme.green, normal = theme.green,
insert = theme.cyan, insert = theme.cyan,
command = theme.orange, command = theme.orange,

View file

@ -4,7 +4,6 @@ local colors = {
white = theme.text, white = theme.text,
bg = theme.surface, bg = theme.surface,
bg_highlight = theme.surface, bg_highlight = theme.surface,
statusline_bg = theme.base,
normal = theme.pine, normal = theme.pine,
insert = theme.foam, insert = theme.foam,
command = theme.gold, command = theme.gold,

View file

@ -5,7 +5,6 @@ local colors = {
white = themeColors.fg_dark, white = themeColors.fg_dark,
bg = themeColors.bg, bg = themeColors.bg,
bg_highlight = themeColors.bg_highlight, bg_highlight = themeColors.bg_highlight,
statusline_bg = themeColors.bg_dark,
normal = themeColors.blue, normal = themeColors.blue,
insert = themeColors.teal, insert = themeColors.teal,
command = themeColors.orange, command = themeColors.orange,