summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbh <qn+git@excalibur.computer>2026-04-10 15:09:32 +0800
committerbh <qn+git@excalibur.computer>2026-04-10 15:09:32 +0800
commit9db98c7afb503f343fe6efdc41efa96dad374f93 (patch)
tree239e1f211abe2ed966b96af885460202bf18ec4b
parent2d9b023ae7a17a3d6c5905cca561292e685ec6e3 (diff)
Add colours to the Neovim logo in the dashboard
-rw-r--r--lua/config/dashboard.lua45
1 files changed, 37 insertions, 8 deletions
diff --git a/lua/config/dashboard.lua b/lua/config/dashboard.lua
index b5dc2ed..8ccd6d9 100644
--- a/lua/config/dashboard.lua
+++ b/lua/config/dashboard.lua
@@ -14,26 +14,29 @@ local function quote()
return lines
end
+local header_art = {
+ "│ ╲ │ │",
+ "│ ╲ │ │",
+ "│ │╲ ╲ │ │",
+ "│ │ ╲ ╲│ │",
+ "│ │ ╲ │",
+ "│ │ ╲ │",
+}
+
db.setup {
theme = "hyper",
config = {
week_header = {
enable = false
},
- header = {
- "│ ╲ │ │",
- "│ ╲ │ │",
- "│ │╲ ╲ │ │",
- "│ │ ╲ ╲│ │",
- "│ │ ╲ │",
- "│ │ ╲ │",
+ header = vim.list_extend(vim.list_extend({}, header_art), {
" ",
"Neovim v" .. vim.version().major .. '.' .. vim.version().minor .. '.' .. vim.version().patch,
"  " .. os.date("%A, %B %d, %Y"), -- your custom date/day line
"",
"[TIP: To exit Vim, use a Sledgehammer!]",
""
- },
+ }),
shortcut = {
{
icon = " ",
@@ -86,4 +89,30 @@ db.setup {
footer = quote(),
},
}
+
+-- Two-tone header: blue left, green right
+vim.api.nvim_set_hl(0, "DashboardHeaderBlue", { fg = "#3394D4" })
+vim.api.nvim_set_hl(0, "DashboardHeaderGreen", { fg = "#75B35F" })
+local ns = vim.api.nvim_create_namespace("dashboard_header_colours")
+
+vim.api.nvim_create_autocmd("User", {
+ pattern = "DashboardLoaded",
+ callback = function()
+ local bufnr = vim.api.nvim_get_current_buf()
+ if vim.bo[bufnr].filetype ~= "dashboard" then return end
+ for i, line in ipairs(vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)) do
+ local trimmed = line:match("^%s*(.-)%s*$")
+ for _, a in ipairs(header_art) do
+ if trimmed == a then
+ local row = i - 1
+ local col = line:find("%S") - 1
+ local mid = col + vim.str_byteindex(trimmed, 4)
+ vim.api.nvim_buf_add_highlight(bufnr, ns, "DashboardHeaderBlue", row, col, mid)
+ vim.api.nvim_buf_add_highlight(bufnr, ns, "DashboardHeaderGreen", row, mid, col + #trimmed)
+ break
+ end
+ end
+ end
+ end,
+})
end