Compare commits

..

23 Commits

Author SHA1 Message Date
d6dfbe4659 chore(notify): silence missing bg hl warning 2025-03-08 21:20:11 +01:00
4f11874437 chore: cleanup and format style changes 2025-03-08 13:59:28 +01:00
fb38ee0071 fix(syntax): Fixed constants color in templates 2024-07-27 13:38:00 +02:00
bdac891487 feat(lsp): diagnostics use colored bg 2024-07-27 13:18:53 +02:00
2f2a7595a9 fix(diff): fixed unknown diff hl colors 2024-07-27 13:18:21 +02:00
4e6fc21d4a fix(syntax): constants are now const colored 2024-07-27 13:01:45 +02:00
a2f4bb71e7 feat(syntax): make numbers purple to better
differentiates with types
2024-07-27 12:53:53 +02:00
8bbdc8639c feat(lsp): make reference highlights colored 2024-07-27 12:50:40 +02:00
214b7f2611 fix(illuminate): fixed typo in hl links 2024-07-27 12:36:24 +02:00
9152f3869f chore(project): added project and formater configs 2024-03-16 12:35:14 +01:00
8e55b8a20d chore(format) 2024-03-16 12:34:49 +01:00
970adcc6ca feat(neotree): tab separator theme missing 2024-03-16 12:34:27 +01:00
48a9c09369 feat(core): better popup background 2024-03-16 12:33:25 +01:00
84ec08a97b feat(heirline): higher contrast inactive buffers 2024-03-16 12:30:22 +01:00
db179859cc feat: more color to member variables 2024-02-26 11:48:57 +01:00
078b99fa17 fix: link @type.builtin to @type 2024-02-25 20:18:37 +01:00
2131742250 Clear FoldColumn 2024-02-21 17:00:21 +01:00
0c657b5bc8 Added heirline setup_colors support
Match active tab with winbar background
2024-02-21 14:22:01 +01:00
76feae8704 Fixed statusline and tabline background 2024-02-21 10:53:19 +01:00
e4cfb6ebd0 Refacto palette and theme, added more colors 2024-02-18 16:46:13 +01:00
8a91acbe19 Fix incorrect name status 2024-02-14 21:37:10 +01:00
d578f233fa Neo-tree support 2024-02-14 18:41:29 +01:00
701b34906e Statusbar background fixes 2024-02-14 18:40:07 +01:00
20 changed files with 494 additions and 241 deletions

24
lua/astrobox/config.lua Normal file
View File

@@ -0,0 +1,24 @@
---@enum Contrast
local CONTRASTS = {
soft = "soft",
medium = "medium",
hard = "hard",
}
---@class Config
---@field contrast Contrast
local M = {
---@type Config
default = {
contrast = CONTRASTS.medium,
},
}
---@param user_cfg Config
---@return Config
function M.make_config(user_cfg)
return user_cfg and vim.tbl_extend("force", M.default, user_cfg) or M.default
end
return M

10
lua/astrobox/heirline.lua Normal file
View File

@@ -0,0 +1,10 @@
local M = {}
function M.setup_colors(colors)
local theme = require("astrobox").theme
colors.buffer_active_bg = colors.tab_active_bg
colors.buffer_fg = theme.statusbar.inactive.fg
return colors
end
return M

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,6 +1,6 @@
return function()
return function(theme)
return {
HeirlineInactive = { link = "StatusInactive" },
HeirlineInactive = theme.error,
HeirlineNormal = { link = "StatusNormal" },
HeirlineInsert = { link = "StatusInsert" },
HeirlineVisual = { link = "StatusVisual" },

View File

@@ -1,127 +1,96 @@
return function(palette)
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
Normal = { fg = palette.fg, bg = palette.bg },
NormalNC = { link = "Normal" },
-- Italic = { italic = true },
-- Bold = { bold = true },
Conceal = { fg = palette.other.conceal, bg = palette.other.harder_bg },
SpecialKey = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
NonText = { fg = palette.ui.fg_inactive, bg = palette.none },
EndOfBuffer = { fg = palette.bg, bg = palette.bg },
Directory = { fg = palette.blue, bg = palette.none },
QuickFixLine = palette.ui.selection,
Conceal = theme.conceal,
Directory = theme.files.directory,
EndOfBuffer = { link = "Normal" },
MatchParen = { fg = palette.none, bg = palette.none, bold = true, underline = true },
NonText = { fg = theme.conceal.fg },
Normal = theme.normal,
NormalNC = { link = "Normal" },
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,
},
StatusLine = { fg = palette.ui.fg, bg = palette.ui.bg },
StatusLineNC = { fg = palette.ui.fg_inactive, bg = palette.ui.bg },
StatusNormal = { fg = palette.ui.bg, bg = palette.blue },
StatusInsert = { fg = palette.ui.bg, bg = palette.green },
StatusVisual = { fg = palette.ui.bg, bg = palette.purple },
StatusReplace = { fg = palette.ui.bg, bg = palette.red },
StatusCommand = { fg = palette.ui.bg, bg = palette.yellow },
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 = theme.statusbar.normal.bg, bg = palette.purple },
TabLine = theme.statusbar.inactive,
TabLineFill = theme.statusbar.normal,
TabLineSel = theme.statusbar.active,
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 = theme.active,
CursorLineNr = { fg = theme.normal.fg },
LineNr = theme.inactive,
lCursor = { link = "Cursor" },
CursorLineNr = { fg = palette.ui.fg, bg = palette.none },
LineNr = { fg = palette.ui.fg_inactive, bg = palette.none },
-- Columns
Folded = { fg = palette.ui.fg_inactive, bg = palette.none },
FoldColumn = { fg = palette.ui.fg_inactive, bg = palette.none },
SignColumn = { fg = palette.none, bg = palette.none }, -- TODO Test
ColorColumn = { fg = palette.none, bg = palette.other.bg_active },
CursorLine = { fg = palette.none, bg = palette.other.bg_active },
CursorColumn = { link = "CursorLine" },
ColorColumn = theme.active,
FoldColumn = theme.none,
Folded = theme.conceal,
SignColumn = theme.none,
-- Splits
WinSeparator = {
fg = palette.ui.win.separator,
bg = palette.bg,
-- bold = false,
},
VertSplit = {
fg = palette.ui.win.separator,
bg = palette.bg,
},
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?
DiffChanged = { link = "DiffChange" },
DiffOldFile = theme.diff.normal.del,
DiffNewFile = theme.diff.normal.add,
DiffFile = { fg = palette.purple, italic = true },
DiffLine = { fg = palette.blue },
DiffIndexLine = { fg = palette.yellow, italic = true },
-- 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

@@ -0,0 +1,32 @@
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
NeoTreeDirectoryIcon = { link = "Directory" },
NeoTreeRootName = theme.files.root,
NeoTreeFileName = theme.files.file,
NeoTreeFileIcon = { link = "NeoTreeFileName" },
NeoTreeIndentMarker = theme.inactive,
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,
NeoTreeSymbolicLinkTarget = { fg = palette.aqua },
NeoTreeTabActive = theme.statusbar.inactive,
NeoTreeTabSeparatorActive = theme.statusbar.inactive,
NeoTreeTabInactive = theme.winbar.inactive,
NeoTreeTabSeparatorInactive = theme.winbar.inactive,
NeoTreeTitleBar = theme.popup.title2,
}
end

View File

@@ -0,0 +1,31 @@
---@param theme Theme
---@param palette Palette
return function(theme, palette)
return {
NotifyBackground = { link = "Normal" },
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" },
@@ -18,7 +20,7 @@ return function(palette)
Keyword = { fg = palette.red, bg = palette.none },
Label = { link = "Keyword" },
Macro = { fg = palette.orange, bg = palette.none },
Number = { fg = palette.yellow, bg = palette.none },
Number = { fg = palette.purple, bg = palette.none },
Operator = { fg = palette.orange, bg = palette.none },
PreCondit = { link = "PreProc" },
PreProc = { fg = palette.bg_gradiant[4], bg = palette.none },
@@ -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 },
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 },
DiagnosticError = theme.msg.error,
DiagnosticHint = theme.msg.hint,
DiagnosticInfo = theme.msg.info,
DiagnosticWarn = theme.msg.warning,
DiagnosticUnderlineError = { sp = palette.red, bg = palette.colored_backgrounds.red },
DiagnosticUnderlineHint = { sp = palette.aqua, bg = palette.colored_backgrounds.aqua },
DiagnosticUnderlineInfo = { sp = palette.blue, bg = palette.colored_backgrounds.blue },
DiagnosticUnderlineWarn = { sp = palette.yellow, bg = palette.colored_backgrounds.yellow },
LspInlayHint = theme.conceal,
LspCodeLens = { link = "LspInlayHint" },
LspCodeLensSeparator = { link = "LspCodeLens" },
LspReferenceRead = { fg = palette.none, bg = palette.harder_bg },
LspReferenceWrite = { fg = palette.none, bg = palette.harder_bg },
LspReferenceText = { fg = palette.none, bg = palette.softer_bg }, -- TODO Keep different?
LspReferenceRead = { fg = palette.none, bg = palette.colored_backgrounds.aqua },
LspReferenceWrite = { fg = palette.none, bg = palette.colored_backgrounds.orange },
LspReferenceText = { fg = palette.none, bg = palette.bg_gradiant[1] },
["@annotation"] = { fg = palette.yellow },
["@attribute"] = { fg = palette.yellow },
@@ -93,7 +95,7 @@ return function(palette)
["@operator"] = { link = "@keyword.operator" }, -- Deprecated?
["@parameter"] = { link = "@variable.parameter" }, -- Deprecated
["@preproc"] = { link = "PreProc" },
["@property"] = { link = "@field" },
["@property"] = { link = "@variable.member" },
["@punctuation.bracket"] = { link = "Identifier" },
["@punctuation.delimiter"] = { fg = palette.orange },
["@punctuation.special"] = { link = "Special" },
@@ -111,11 +113,12 @@ return function(palette)
["@tag.attribute"] = { fg = palette.yellow },
["@tag.delimiter"] = { fg = palette.fg },
["@type"] = { link = "Type" },
["@type.builtin"] = { link = "@type" },
["@type.qualifier"] = { fg = palette.purple },
["@typeParameter"] = { fg = palette.yellow },
["@variable"] = { link = "Identifier" },
["@variable.builtin"] = { bold = true },
["@variable.member"] = { link = "Identifier" },
["@variable.member"] = theme.highlight,
["@variable.parameter"] = { fg = palette.fg_gradiant[2] },
-- LSP
@@ -134,18 +137,21 @@ return function(palette)
["@lsp.type.namespace"] = { fg = palette.fg_gradiant[2] },
["@lsp.type.operator"] = { link = "Operator" },
["@lsp.type.parameter"] = { link = "@parameter" },
["@lsp.type.property"] = { link = "@property" },
["@lsp.type.property"] = { link = "@variable.member" },
["@lsp.type.selfTypeKeyword"] = { fg = palette.green, bold = true },
["@lsp.type.string"] = { link = "@string" },
["@lsp.type.struct"] = { link = "@struct" },
["@lsp.type.typeParameter"] = { link = "@type" },
["@lsp.type.unresolvedReference"] = { fg = palette.purple },
["@lsp.type.variable"] = { link = "@variable" },
["@lsp.typemod.class.constructorOrDestructor"] = { link = "@constructor" },
["@lsp.typemod.comment.documentation"] = { link = "@comment.documentation" },
["@lsp.typemod.const.constant"] = { link = "Constant" },
["@lsp.typemod.constParameter.constant"] = { link = "Constant" },
["@lsp.typemod.derive.attribute"] = { fg = palette.blue },
["@lsp.typemod.method"] = { link = "@method" },
["@lsp.typemod.selfKeyword"] = { fg = palette.fg, bold = true },
["@lsp.typemod.string.attribute"] = { link = "String" }, -- Hmmmm
["@lsp.typemod.selfKeyword"] = theme.highlight_bold,
["@lsp.typemod.string.attribute"] = { link = "String" },
["@lsp.typemod.variable.readonly"] = { link = "Constant" },
}
end

View File

@@ -0,0 +1,7 @@
return function()
return {
IlluminatedWordText = { link = "LspReferenceText" },
IlluminatedWordRead = { link = "LspReferenceRead" },
IlluminatedWordWrite = { link = "LspReferenceWrite" },
}
end

View File

@@ -1,36 +1,44 @@
local palette = require("astrobox.palette")
local config = require("astrobox.config")
local highlights = require("astrobox.highlights")
local default_cfg = {
contrast = "default", -- soft, default or hard
overrides = {}
}
local palette = require("astrobox.palette")
local theme = require("astrobox.theme")
local M = {
cfg = {},
palette = {},
---@type Config
cfg = nil,
---@type Palette
palette = nil,
---@type Theme
theme = nil,
---@type table
hl = {},
}
---@param user_cfg Config
function M.setup(user_cfg)
M.cfg = user_cfg
M.cfg = config.make_config(user_cfg)
-- If the colors are set, assume we're reloading and auto apply
if vim.g.colors_name == "astrobox" then
vim.cmd.colorscheme("astrobox")
end
end
function M.set_highlights(list)
vim.cmd.highlight("clear")
for hl, def in pairs(list) do
vim.api.nvim_set_hl(0, hl, def)
end
end
function M.load()
local cfg = vim.tbl_extend("force", default_cfg, M.cfg or {})
M.palette = palette(cfg)
M.hl = highlights(M.palette, cfg)
for index, color in ipairs(M.palette.term_colors) do
M.palette = palette(M.cfg)
M.theme = theme.make_theme(M.palette, M.cfg)
M.hl = highlights.make_highlights(M.theme, M.palette, M.cfg)
for index, color in ipairs(M.theme.term_colors) do
vim.g["terminal_color_" .. index - 1] = color
end
vim.g.colors_name = "astrobox"
M.set_highlights(M.hl)
vim.g.colors_name = "astrobox"
end
return M

View File

@@ -1,84 +0,0 @@
local colors = require("astrobox.colors")
return function(config)
local vimbg = vim.o.background
local dark = vimbg == "dark"
local vimbg_reversed = dark and "light" or "dark"
-- Build base colors
local base = {
none = "",
fg = colors.grayscale[vimbg_reversed][1],
bg = colors.bg[vimbg][config.contrast],
harder_bg = colors.bg.harder[vimbg][config.contrast],
softer_bg = colors.bg.softer[vimbg][config.contrast],
bg_gradiant = colors.grayscale[vimbg],
fg_gradiant = colors.grayscale[vimbg_reversed],
colored_backgrounds = colors.colored_backgrounds[vimbg][config.contrast],
gray = colors.gray, -- TODO Rémy Only for comments? Won't look good in light mode
}
-- Append colors
local palette = vim.tbl_extend("error", base, colors.colors[vimbg])
palette.ui = {
fg = palette.fg,
bg = palette.bg_gradiant[1],
bg_hard = palette.harder_bg,
fg_inactive = palette.fg_gradiant[4],
bg_inactive = palette.bg_gradiant[2],
float = {
title = palette.green,
title2 = palette.aqua,
border = palette.fg_gradiant[3],
text = palette.fg_gradiant[2],
scroll = palette.blue,
},
winbar = {
fg = palette.fg_gradiant[1],
bg = palette.harder_bg,
fg_inactive = palette.bg_gradiant[3],
bg_inactive = palette.harder_bg,
},
selection = {
fg = palette.fg,
bg = palette.colored_backgrounds.blue,
},
win = {
separator = palette.fg_gradiant[4],
},
}
palette.other = {
conceal = palette.bg_gradiant[3],
hard_bg = palette.harder_bg,
bg_active = palette.softer_bg,
-- Special HL group to find what a group maps to
error_hl = { fg = "#000000", bg = "#FF00FF" },
}
palette.term_colors = {
palette.bg,
colors.term_colors.red,
colors.term_colors.green,
colors.term_colors.yellow,
colors.term_colors.blue,
colors.term_colors.purple,
colors.term_colors.aqua,
palette.fg_gradiant[4],
palette.gray,
colors.colors.red,
colors.colors.green,
colors.colors.yellow,
colors.colors.blue,
colors.colors.purple,
colors.colors.aqua,
palette.fg,
}
return palette
end

View File

@@ -1,37 +1,46 @@
---@class Colors
---@field red string
---@field green string
---@field yellow string
---@field blue string
---@field purple string
---@field aqua string
---@field orange string
return {
none = nil,
none = "NONE",
bg = {
dark = {
soft = "#32302f",
default = "#282828",
medium = "#282828",
hard = "#1d2021",
},
light = {
soft = "#f2e5bc",
default = "#fbf1c7",
medium = "#fbf1c7",
hard = "#f9f5d7",
},
harder = {
dark = {
soft = "#282828",
default = "#1d2021",
medium = "#1d2021",
hard = "#171a1a",
},
light = {
soft = "#fbf1c7",
default = "#f9f5d7",
medium = "#f9f5d7",
hard = "#faf7df",
},
},
softer = {
dark = {
soft = "#343230",
default = "#32302f",
medium = "#32302f",
hard = "#282828",
},
light = {
soft = "#f1e3ba",
default = "#f2e5bc",
medium = "#f2e5bc",
hard = "#fbf1c7",
},
},
@@ -55,6 +64,7 @@ return {
},
colors = {
--- @type Colors
dark = {
red = "#fb4934",
green = "#b8bb26",
@@ -64,6 +74,7 @@ return {
aqua = "#8ec07c",
orange = "#fe8019",
},
--- @type Colors
light = {
red = "#9d0006",
green = "#79740e",
@@ -75,6 +86,7 @@ return {
},
},
--- @type Colors
term_colors = {
red = "#cc241d",
green = "#98971a",
@@ -84,47 +96,73 @@ return {
aqua = "#689d6a",
orange = "#d65d0e",
},
-- Note: Lerped from colors and backgrounds.
colored_backgrounds = {
-- Coeff is 0.8 with exceptions
dark = {
--- @type Colors
soft = {
red = "#5a3530",
green = "#4d4c2d",
yellow = "#6e5a2f",
yellow = "#6e5a2f", -- 0.7
blue = "#4a534f",
purple = "#524145",
aqua = "#444d3e",
orange = "#5b402b",
},
default = {
--- @type Colors
medium = {
red = "#522f2a",
green = "#454528",
yellow = "#67552a",
yellow = "#67552a", -- 0.7
blue = "#434e4a",
purple = "#4a3b3f",
aqua = "#3c4639",
orange = "#533a25",
},
--- @type Colors
hard = {
red = "#492825",
green = "#3c3f22",
yellow = "#5f4f25",
yellow = "#5f4f25", -- 0.7
blue = "#3c4845",
purple = "#413439",
aqua = "#344033",
orange = "#4a331f",
},
},
-- 0.6 with exceptions
light = {
--- @type Colors
soft = {
red = "#d08973",
green = "#c2b876",
yellow = "#e0c48a",
blue = "#acbfa8",
blue = "#acbfa8", -- 0.7
purple = "#caa39e",
aqua = "#acbb94",
orange = "#d7a172",
},
default = {
--- @type Colors
medium = {
red = "#d5917a",
green = "#c7bf7d",
yellow = "#e6cc91",
blue = "#b2c7af",
blue = "#b2c7af", -- 0.7
purple = "#d0aaa5",
aqua = "#b1c29b",
orange = "#dda879",
},
--- @type Colors
hard = {
red = "#d49383",
green = "#c6c187",
yellow = "#e5cf9d",
blue = "#b0cabb",
blue = "#b0cabb", -- 0.7
purple = "#cfacae",
aqua = "#b0c4a4",
orange = "#dbaa82",
},
},
},

View File

@@ -0,0 +1,42 @@
---@class Palette : Colors
---@field none string
---@field fg string
---@field bg string
---@field harder_bg string
---@field softer_bg string
---@field bg_gradiant table
---@field fg_gradiant table
---@field colored_backgrounds Colors
---@field term_colors Colors
---@field gray string
local colors = require("astrobox.palette.colors")
--- @return Palette
return function(config)
local vimbg = vim.o.background
local dark = vimbg == "dark"
local vimbg_reversed = dark and "light" or "dark"
-- Build base colors
local base = {
none = colors.none,
fg = colors.grayscale[vimbg_reversed][1],
bg = colors.bg[vimbg][config.contrast],
harder_bg = colors.bg.harder[vimbg][config.contrast],
softer_bg = colors.bg.softer[vimbg][config.contrast],
bg_gradiant = colors.grayscale[vimbg],
fg_gradiant = colors.grayscale[vimbg_reversed],
colored_backgrounds = colors.colored_backgrounds[vimbg][config.contrast],
term_colors = colors.term_colors,
gray = colors.gray,
}
-- Append colors
local palette = vim.tbl_extend("error", base, colors.colors[vimbg])
return palette
end

138
lua/astrobox/theme.lua Normal file
View File

@@ -0,0 +1,138 @@
local M = {}
---@param P Palette
---@param C Config
---@return Theme
---@diagnostic disable-next-line: unused-local
function M.make_theme(P, C)
---@class Theme
local T = {
none = { fg = P.none, bg = P.none },
normal = { fg = P.fg, bg = P.bg },
highlight = { fg = P.fg_gradiant[1], bg = P.none },
highlight_bold = { fg = P.fg_gradiant[1], bg = P.none, bold = true },
inverted = { fg = P.bg, bg = P.fg },
inactive = { fg = P.fg_gradiant[4] },
conceal = { fg = P.bg_gradiant[3], bg = P.harder_bg },
active = { fg = P.none, bg = P.softer_bg },
}
T.error = { fg = "#000000", bg = "#FF00FF" }
T.colors = {
accent = P.blue,
accent2 = P.green,
accent3 = P.aqua,
}
T.backgrounds = {
red = { fg = P.none, bg = P.colored_backgrounds.red },
green = { fg = P.none, bg = P.colored_backgrounds.green },
yellow = { fg = P.none, bg = P.colored_backgrounds.yellow },
blue = { fg = P.none, bg = P.colored_backgrounds.blue },
purple = { fg = P.none, bg = P.colored_backgrounds.purple },
aqua = { fg = P.none, bg = P.colored_backgrounds.aqua },
orange = { fg = P.none, bg = P.colored_backgrounds.orange },
}
T.diff = {
normal = {
add = { fg = P.green, bg = P.none },
text = { fg = P.yellow, bg = P.none },
change = { fg = P.blue, bg = P.none },
del = { fg = P.red, bg = P.none },
merge = { fg = P.purple, bg = P.none },
staged = { fg = P.aqua, bg = P.none },
},
bg = {
add = T.backgrounds.green,
text = T.backgrounds.yellow,
change = T.backgrounds.blue,
del = T.backgrounds.red,
},
}
T.msg = {
error = { fg = P.red, bg = P.none },
warning = { fg = P.yellow, bg = P.none },
info = { fg = P.blue, bg = P.none },
hint = { fg = P.aqua, bg = P.none },
}
T.files = {
directory = { fg = T.colors.accent },
file = { fg = T.normal.fg },
root = { fg = T.normal.fg, bold = true },
added = { fg = T.colors.diffadd },
changed = { fg = T.colors.difftext },
untracked = { fg = P.orange },
}
T.scrollbar = { fg = P.none, bg = P.colored_backgrounds.blue }
T.windows = {
separator = { fg = P.fg_gradiant[4], bg = P.none },
}
T.popup = {
normal = T.normal,
conceal = T.conceal,
inactive = {
fg = P.fg_gradiant[4],
bg = P.bg_gradiant[2],
},
border = T.windows.separator,
title = { fg = T.colors.accent2, bg = P.none, bold = true }, -- TODO need to switch to normal.bg?
title2 = { fg = T.colors.accent3, bg = P.none, bold = true }, -- TODO need to switch to normal.bg?
}
T.selection = {
fg = P.fg,
bg = P.colored_backgrounds.blue,
}
T.menu = {
normal = { fg = P.fg_gradiant[1], bg = P.harder_bg },
selection = { fg = P.fg_gradiant[1], bg = T.selection.bg },
}
T.statusbar = {
normal = {
fg = P.fg_gradiant[1],
bg = P.bg_gradiant[1],
},
active = {
fg = P.fg_gradiant[1],
bg = P.harder_bg,
bold = true,
},
inactive = {
fg = P.fg_gradiant[2],
bg = P.bg,
},
}
T.winbar = {
normal = {
fg = P.fg_gradiant[1],
bg = P.harder_bg,
},
active = {
fg = P.fg_gradiant[1],
bg = P.bg,
},
inactive = {
fg = P.fg_gradiant[4],
bg = P.harder_bg,
},
}
T.term_colors = {
P.bg,
P.term_colors.red,
P.term_colors.green,
P.term_colors.yellow,
P.term_colors.blue,
P.term_colors.purple,
P.term_colors.aqua,
P.fg_gradiant[4],
P.gray,
P.red,
P.green,
P.yellow,
P.blue,
P.purple,
P.aqua,
P.fg,
}
return T
end
return M

View File

@@ -9,11 +9,13 @@ ASTROBOX_ROOT_PATH = get_module_root_path("astrobox")
local M = {}
---@param module string
---@param visitor function
function M.visit_astrobox_modules(module, visitor)
local modpath = ASTROBOX_ROOT_PATH .. module:gsub("%.", "/")
local hdl, err, msg = vim.loop.fs_scandir(modpath)
if hdl == nil then
print("Astrobox err: " .. err .. " " .. vim.inspect(msg))
vim.notify("Astrobox err: " .. err .. " " .. vim.inspect(msg), vim.log.levels.ERROR)
return
end
while true do
@@ -27,7 +29,7 @@ function M.visit_astrobox_modules(module, visitor)
if ok then
visitor(mod, mod_name)
else
print("AstroBox:Failed to load module " .. mod_name)
vim.notify("AstroBox:Failed to load module " .. mod_name, vim.log.levels.ERROR)
end
end
end

6
neovim.yml Normal file
View File

@@ -0,0 +1,6 @@
---
base: lua51
globals:
vim:
any: true

8
selene.toml Normal file
View File

@@ -0,0 +1,8 @@
std = "neovim"
[rules]
global_usage = "allow"
if_same_then_else = "allow"
incorrect_standard_library_use = "allow"
mixed_table = "allow"
multiple_statements = "allow"

8
stylua.toml Normal file
View File

@@ -0,0 +1,8 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
call_parentheses = "Always"
collapse_simple_statement = "Never"
[sort_requires]
enabled = true