Refacto palette and theme, added more colors

This commit is contained in:
2024-02-18 16:46:13 +01:00
parent 8a91acbe19
commit e4cfb6ebd0
15 changed files with 431 additions and 240 deletions

View File

@@ -1,9 +1,14 @@
local utils = require("astrobox.utils")
return function(palette, config)
local M = {}
--- @param theme Theme
--- @param palette Palette
--- @param config Config
function M.make_highlights(theme, palette, config)
local HL = {}
local function load_mod(mod, mod_name)
local ok, res = pcall(mod, palette, config)
local ok, res = pcall(mod, theme, palette, config)
if ok and res then
HL = vim.tbl_extend("error", HL, res)
else
@@ -12,7 +17,7 @@ return function(palette, config)
end
utils.visit_astrobox_modules("highlights.modules", load_mod)
HL = vim.tbl_extend("force", HL, config.overrides)
return HL
end
return M

View File

@@ -1,120 +1,96 @@
return function(palette)
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
-- Bold = { bold = true },
-- Italic = { italic = true },
Conceal = { fg = palette.other.conceal, bg = palette.other.harder_bg },
Directory = { fg = palette.blue, bg = palette.none },
EndOfBuffer = { fg = palette.bg, bg = palette.bg },
Conceal = theme.conceal,
Directory = theme.files.directory,
EndOfBuffer = { link = "Normal" },
MatchParen = { fg = palette.none, bg = palette.none, bold = true, underline = true },
NonText = { fg = palette.ui.fg_inactive, bg = palette.none },
Normal = { fg = palette.fg, bg = palette.bg },
NonText = { fg = theme.conceal.fg },
Normal = theme.normal,
NormalNC = { link = "Normal" },
QuickFixLine = palette.ui.selection,
QuickFixLine = theme.selection,
SpecialKey = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
Underlined = { fg = palette.aqua, bg = palette.none, underline = true },
-- Popup
FloatTitle = {
fg = palette.ui.float.title,
bg = palette.ui.bg,
bold = true,
},
FloatBorder = {
fg = palette.ui.float.border,
bg = palette.ui.bg,
},
NormalFloat = {
fg = palette.ui.float.text,
bg = palette.ui.bg,
},
Title = {
fg = palette.ui.float.title2,
bg = palette.bg,
bold = true,
},
FloatTitle = theme.popup.title,
FloatBorder = theme.popup.border,
NormalFloat = theme.popup.normal,
Title = theme.popup.title2,
-- Bars
TabLine = { fg = palette.ui.fg_inactive, bg = palette.ui.bg_inactive },
TabLineFill = { fg = palette.none, bg = palette.ui.bg_inactive },
TabLineSel = { fg = palette.ui.fg, bg = palette.ui.bg, bold = true, italic = true },
WinBar = { fg = palette.ui.winbar.fg, bg = palette.ui.winbar.bg },
WinBarNC = {
fg = palette.ui.winbar.fg_inactive,
bg = palette.ui.winbar.bg_inactive,
},
StatusCommand = { fg = palette.ui.statusbar.bg, bg = palette.yellow },
StatusInsert = { fg = palette.ui.statusbar.bg, bg = palette.green },
StatusLine = { fg = palette.ui.statusbar.fg, bg = palette.ui.statusbar.bg },
StatusLineNC = { fg = palette.ui.statusbar.fg_inactive, bg = palette.ui.statusbar.bg },
StatusNormal = { fg = palette.ui.statusbar.bg, bg = palette.blue },
StatusReplace = { fg = palette.ui.statusbar.bg, bg = palette.red },
StatusCommand = { fg = theme.statusbar.normal.bg, bg = palette.yellow },
StatusInsert = { fg = theme.statusbar.normal.bg, bg = palette.green },
StatusLine = theme.statusbar.normal,
StatusLineNC = theme.statusbar.inactive,
StatusNormal = { fg = theme.statusbar.normal.bg, bg = palette.blue },
StatusReplace = { fg = theme.statusbar.normal.bg, bg = palette.red },
StatusTerminal = { link = "StatusInsert" },
StatusVisual = { fg = palette.ui.statusbar.bg, bg = palette.purple },
StatusVisual = { fg = theme.statusbar.normal.bg, bg = palette.purple },
TabLine = theme.statusbar.normal,
TabLineFill = { link = "TabLine" },
TabLineSel = vim.tbl_extend("error", theme.statusbar.inactive, { bold = true, italic = true }),
WinBar = theme.winbar.normal,
WinBarNC = theme.winbar.inactive,
-- Cursor
Cursor = { fg = palette.fg, bg = palette.bg },
Cursor = { link = "Normal" },
CursorColumn = { link = "CursorLine" },
CursorIM = { link = "Cursor" },
CursorLine = { fg = palette.none, bg = palette.other.bg_active },
CursorLineNr = { fg = palette.ui.fg, bg = palette.none },
LineNr = { fg = palette.ui.fg_inactive, bg = palette.none },
CursorLine = theme.active,
CursorLineNr = { fg = theme.normal.fg },
LineNr = theme.inactive,
lCursor = { link = "Cursor" },
-- Columns
ColorColumn = { fg = palette.none, bg = palette.other.bg_active },
FoldColumn = { fg = palette.ui.fg_inactive, bg = palette.none },
Folded = { fg = palette.ui.fg_inactive, bg = palette.none },
SignColumn = { fg = palette.none, bg = palette.none }, -- TODO Test
ColorColumn = theme.active,
FoldColumn = theme.active,
Folded = theme.conceal,
SignColumn = theme.none,
-- Splits
WinSeparator = {
fg = palette.ui.win.separator,
bg = palette.bg,
-- bold = false,
},
WinSeparator = theme.windows.separator,
-- Diff
DiffAdd = { fg = palette.none, bg = palette.colored_backgrounds.green },
DiffChange = { fg = palette.none, bg = palette.colored_backgrounds.blue },
DiffDelete = { fg = palette.none, bg = palette.colored_backgrounds.red },
DiffText = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
DiffAdd = theme.diff.bg.add,
DiffChange = theme.diff.bg.change,
DiffDelete = theme.diff.bg.del,
DiffText = theme.diff.bg.text,
DiffAdded = { link = "DiffAdd" },
DiffRemoved = { link = "DiffDelete" },
DiffChanged = { link = "DiffText" }, -- TODO Switch to DiffChange?
DiffOldFile = { fg = palette.red, bg = palette.bg },
DiffNewFile = { fg = palette.green, bg = palette.bg },
DiffFile = palette.other.error_hl, -- TODO What's this?
DiffLine = palette.other.error_hl, -- TODO What's this?
DiffIndexLine = palette.other.error_hl, -- TODO What's this?
DiffOldFile = theme.diff.normal.del,
DiffNewFile = theme.diff.normal.add,
DiffFile = theme.error, -- TODO What's this?
DiffLine = theme.error, -- TODO What's this?
DiffIndexLine = theme.error,
-- Cmd
ErrorMsg = { fg = palette.red, bg = palette.none },
WarningMsg = { fg = palette.yellow, bg = palette.none },
Question = { fg = palette.blue, bg = palette.none },
WildMenu = { fg = palette.ui.selection.fg, bg = palette.ui.selection.bg },
ErrorMsg = theme.msg.error,
WarningMsg = theme.msg.warning,
Question = theme.msg.info,
WildMenu = theme.selection,
-- PMenu
Pmenu = { fg = palette.ui.fg, bg = palette.ui.bg_hard },
PmenuSel = { fg = palette.ui.selection.fg, bg = palette.ui.selection.bg },
PmenuSbar = { fg = palette.none, bg = palette.ui.float.scroll },
Pmenu = theme.menu.normal,
PmenuSel = theme.menu.selection,
PmenuSbar = theme.scrollbar,
PmenuThumb = { link = "PmenuSbar" },
-- Search
Search = { fg = palette.fg, bg = palette.other.bg_active },
IncSearch = { fg = palette.none, bg = palette.colored_backgrounds.blue },
Substitute = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
CurSearch = { link = "IncSearch" },
Visual = { fg = palette.none, bg = palette.other.bg_active },
VisualNOS = { fg = palette.other.bg_active, bg = palette.fg }, -- Meh
Search = theme.backgrounds.blue,
IncSearch = theme.backgrounds.green,
Substitute = theme.backgrounds.yellow,
CurSearch = theme.backgrounds.purple,
Visual = theme.backgrounds.aqua,
VisualNOS = theme.backgrounds.red,
-- Spelling

View File

@@ -1,7 +1,8 @@
return function(palette)
---@param theme Theme
return function(theme)
return {
GitSignsAdd = { fg = palette.green },
GitSignsChange = { fg = palette.yellow },
GitSignsDelete = { fg = palette.red },
GitSignsAdd = theme.diff.normal.add,
GitSignsChange = theme.diff.normal.text,
GitSignsDelete = theme.diff.normal.del,
}
end

View File

@@ -1,4 +1,6 @@
return function(palette)
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
["@markup"] = { fg = palette.fg },
["@markup.checked"] = { fg = palette.green },
@@ -8,9 +10,9 @@ return function(palette)
["@markup.emphasis"] = { fg = palette.fg, italic = true },
["@markup.environment"] = { fg = palette.yellow },
["@markup.environment.name"] = { fg = palette.orange },
["@markup.heading"] = { fg = palette.green, bold = true },
["@markup.heading.1.markdown"] = { fg = palette.blue, bold = true },
["@markup.heading.2.markdown"] = { fg = palette.aqua, bold = true },
["@markup.heading"] = { fg = theme.colors.accent, bold = true },
["@markup.heading.1.markdown"] = { fg = theme.colors.accent2, bold = true },
["@markup.heading.2.markdown"] = { fg = theme.colors.accent3, bold = true },
["@markup.heading.3.markdown"] = { fg = palette.purple, bold = true },
["@markup.heading.4.markdown"] = { fg = palette.yellow, bold = true },
["@markup.link"] = { fg = palette.aqua, bold = true },
@@ -31,7 +33,7 @@ return function(palette)
["@markup.todo.warning"] = { link = "@markup.warning" },
["@markup.unchecked"] = { fg = palette.blue },
["@markup.underline"] = { link = "Underline" },
["@markup.warning"] = { fg = palette.yellow },
["@markup.warning"] = { fg = theme.colors.warning },
-- Deprecated
["@text"] = { fg = palette.fg },

View File

@@ -1,26 +1,30 @@
return function(palette)
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
NeoTreeDirectoryIcon = { fg = palette.blue },
NeoTreeRootName = { fg = palette.ui.fg, bold = true },
NeoTreeFileName = { fg = palette.ui.fg },
NeoTreeFileIcon = { fg = palette.ui.fg },
NeoTreeFloatTitle = { link = "FloatTitle" },
NeoTreeIndentMarker = { fg = palette.other.conceal },
NeoTreeDirectoryIcon = { link = "Directory" },
NeoTreeRootName = theme.files.root,
NeoTreeFileName = theme.files.file,
NeoTreeFileIcon = { link = "NeoTreeFileName" },
NeoTreeIndentMarker = theme.inactive,
NeoTreeGitAdded = { fg = palette.green },
NeoTreeGitConflict = { fg = palette.red },
NeoTreeGitDeleted = { fg = palette.fg_inactive },
NeoTreeGitIgnored = { fg = palette.fg },
NeoTreeGitModified = { fg = palette.orange },
NeoTreeGitRenamed = { fg = palette.orange },
NeoTreeGitStaged = { fg = palette.aqua },
NeoTreeGitUntracked = { fg = palette.yellow },
NeoTreeGitUnstaged = { fg = palette.yellow },
NeoTreeGitAdded = theme.diff.normal.add,
NeoTreeGitConflict = theme.diff.normal.merge,
NeoTreeGitDeleted = theme.diff.normal.del,
NeoTreeGitIgnored = theme.inactive,
NeoTreeGitModified = theme.diff.normal.orange,
NeoTreeGitRenamed = { link = "NeoTreeGitModified" },
NeoTreeGitStaged = theme.diff.normal.staged,
NeoTreeGitUntracked = theme.diff.normal.text,
NeoTreeGitUnstaged = { link = "NeoTreeFileName" },
NeoTreeCursorLine = theme.selection,
NeoTreeFloatBorder = theme.popup.border,
NeoTreeFloatTitle = theme.popup.title,
NeoTreeTitleBar = { fg = palette.ui.float.title2, bg = palette.ui.fg, bold = true },
NeoTreeSymbolicLinkTarget = { fg = palette.aqua },
NeoTreeTabActive = { fg = palette.ui.fg, bg = palette.ui.bg, bold = true },
NeoTreeTabInactive = { fg = palette.ui.winbar.fg_inactive, bg = palette.ui.winbar.bg },
NeoTreeCursorLine = { fg = palette.none, bg = palette.ui.selection.bg },
NeoTreeTabActive = vim.tbl_extend("error", theme.statusbar.active, { bold = true }),
NeoTreeTabInactive = theme.winbar.inactive,
NeoTreeTitleBar = theme.popup.title2,
}
end

View File

@@ -0,0 +1,26 @@
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
NotifyERRORBorder = theme.msg.error,
NotifyWARNBorder = theme.msg.warning,
NotifyINFOBorder = theme.msg.info,
NotifyDEBUGBorder = theme.msg.hint,
NotifyTRACEBorder = theme.msg.error,
NotifyERRORIcon = { link = "NotifyERRORBorder" },
NotifyWARNIcon = { link = "NotifyWARNBorder" },
NotifyINFOIcon = { link = "NotifyINFOBorder" },
NotifyDEBUGIcon = { link = "NotifyDEBUGBorder" },
NotifyTRACEIcon = { link = "NotifyTRACEBorder" },
NotifyERRORTitle = { link = "NotifyERRORBorder" },
NotifyWARNTitle = { link = "NotifyWARNBorder" },
NotifyINFOTitle = { link = "NotifyINFOBorder" },
NotifyDEBUGTitle = { link = "NotifyDEBUGBorder" },
NotifyTRACETitle = { link = "NotifyTRACEBorder" },
NotifyERRORBody = { link = "Normal" },
NotifyWARNBody = { link = "Normal" },
NotifyINFOBody = { link = "Normal" },
NotifyDEBUGBody = { link = "Normal" },
NotifyTRACEBody = { link = "Normal" },
}
end

View File

@@ -1,4 +1,6 @@
return function(palette)
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
Boolean = { fg = palette.yellow, bg = palette.none },
Character = { link = "String" },
@@ -36,20 +38,20 @@ return function(palette)
Typedef = { link = "Keyword" },
-- Diags
DiagnosticError = { fg = palette.red },
DiagnosticHint = { fg = palette.aqua },
DiagnosticInfo = { fg = palette.blue },
DiagnosticWarn = { fg = palette.yellow },
DiagnosticError = theme.msg.error,
DiagnosticHint = theme.msg.hint,
DiagnosticInfo = theme.msg.info,
DiagnosticWarn = theme.msg.warning,
DiagnosticUnderlineError = { sp = palette.red, undercurl = true },
DiagnosticUnderlineHint = { sp = palette.aqua, undercurl = true },
DiagnosticUnderlineInfo = { sp = palette.blue, undercurl = true },
DiagnosticUnderlineWarn = { sp = palette.yellow, undercurl = true },
LspInlayHint = { fg = palette.other.conceal, bg = palette.other.hard_bg },
LspInlayHint = theme.conceal,
LspCodeLens = { link = "LspInlayHint" },
LspCodeLensSeparator = { link = "LspCodeLens" },
LspReferenceRead = { fg = palette.none, bg = palette.harder_bg },
LspReferenceRead = theme.active,
LspReferenceWrite = { fg = palette.none, bg = palette.harder_bg },
LspReferenceText = { fg = palette.none, bg = palette.softer_bg }, -- TODO Keep different?
LspReferenceText = theme.active,
["@annotation"] = { fg = palette.yellow },
["@attribute"] = { fg = palette.yellow },

View File

@@ -0,0 +1,7 @@
return function()
return {
IlluminatedWordText = { link = "LspeferenceText" },
IlluminatedWordRead = { link = "LspeferenceRead" },
IlluminatedWordWrite = { link = "LspeferenceWrite" },
}
end