refactor(nvim): change header logo for dashboard (alpha)
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 33s
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 33s
This commit is contained in:
parent
e8384118a8
commit
cddedfdfbb
@ -16,35 +16,91 @@ return {
|
||||
end,
|
||||
lazy = true,
|
||||
opts = function()
|
||||
-- Set header
|
||||
local header = {
|
||||
type = "text",
|
||||
val = {
|
||||
" ",
|
||||
" ",
|
||||
" -╲ '- ",
|
||||
" -' :╲ │ '- ",
|
||||
" -' : ╲ │ '- ",
|
||||
" -'· : ╲ │ '- ",
|
||||
" '.-.· : ╲ │ │ ",
|
||||
" │. .-· : ╲ │ │ ",
|
||||
" │ . .-· : ╲ │ │ ",
|
||||
" │. . .-·; ╲ │ │ ",
|
||||
" │ . . .-│ ╲ │ │ ",
|
||||
" │. . . .│╲ ╲│ │ ",
|
||||
" │ . . . │ ╲ ;- │ ",
|
||||
" │. . . .│ ╲ :·- │ ",
|
||||
" │ . . . │ ╲ : .- │ ",
|
||||
" │. . . .│ ╲ :. .- │ ",
|
||||
" `- . . .│ ╲ : . .- -' ",
|
||||
" `- . .│ ╲ :. ..-' ",
|
||||
" `-. │ ╲ :..-' ",
|
||||
" `│ ╲;-' ",
|
||||
" ",
|
||||
" ",
|
||||
},
|
||||
opts = { position = "center", hl = "@boolean" },
|
||||
}
|
||||
-- helper function for utf8 chars
|
||||
local function getCharLen(s, pos)
|
||||
local byte = string.byte(s, pos)
|
||||
if not byte then
|
||||
return nil
|
||||
end
|
||||
return (byte < 0x80 and 1) or (byte < 0xE0 and 2) or (byte < 0xF0 and 3) or (byte < 0xF8 and 4) or 1
|
||||
end
|
||||
|
||||
local function applyColors(logo, colors, logoColors)
|
||||
local header = {
|
||||
val = logo,
|
||||
opts = {
|
||||
hl = {},
|
||||
},
|
||||
}
|
||||
|
||||
for key, color in pairs(colors) do
|
||||
local name = "Alpha" .. key
|
||||
vim.api.nvim_set_hl(0, name, color)
|
||||
colors[key] = name
|
||||
end
|
||||
|
||||
for i, line in ipairs(logoColors) do
|
||||
local highlights = {}
|
||||
local pos = 0
|
||||
|
||||
for j = 1, #line do
|
||||
local opos = pos
|
||||
pos = pos + getCharLen(logo[i], opos + 1)
|
||||
|
||||
local color_name = colors[line:sub(j, j)]
|
||||
if color_name then
|
||||
table.insert(highlights, { color_name, opos, pos })
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(header.opts.hl, highlights)
|
||||
end
|
||||
return header
|
||||
end
|
||||
-- Thanks to https://github.com/goolord/alpha-nvim/discussions/16#discussioncomment-10062303
|
||||
local header = applyColors({
|
||||
[[ ███ ███ ]],
|
||||
[[ ████ ████ ]],
|
||||
[[ ████ █████ ]],
|
||||
[[ █ ████ █████ ]],
|
||||
[[ ██ ████ █████ ]],
|
||||
[[ ███ ████ █████ ]],
|
||||
[[ ████ ████ ████ ]],
|
||||
[[ █████ ████████ ]],
|
||||
[[ █████ ███████ ]],
|
||||
[[ █████ ██████ ]],
|
||||
[[ █████ █████ ]],
|
||||
[[ ████ ████ ]],
|
||||
[[ ███ ███ ]],
|
||||
[[ ]],
|
||||
[[ N E O V I M ]],
|
||||
}, {
|
||||
["b"] = { fg = "#3399ff", ctermfg = 33 },
|
||||
["a"] = { fg = "#53C670", ctermfg = 35 },
|
||||
["g"] = { fg = "#39ac56", ctermfg = 29 },
|
||||
["h"] = { fg = "#33994d", ctermfg = 23 },
|
||||
["i"] = { fg = "#33994d", bg = "#39ac56", ctermfg = 23, ctermbg = 29 },
|
||||
["j"] = { fg = "#53C670", bg = "#33994d", ctermfg = 35, ctermbg = 23 },
|
||||
["k"] = { fg = "#30A572", ctermfg = 36 },
|
||||
}, {
|
||||
[[ kkkka gggg ]],
|
||||
[[ kkkkaa ggggg ]],
|
||||
[[ b kkkaaa ggggg ]],
|
||||
[[ bb kkaaaa ggggg ]],
|
||||
[[ bbb kaaaaa ggggg ]],
|
||||
[[ bbbb aaaaaa ggggg ]],
|
||||
[[ bbbbb aaaaaa igggg ]],
|
||||
[[ bbbbb aaaaaahiggg ]],
|
||||
[[ bbbbb aaaaajhigg ]],
|
||||
[[ bbbbb aaaaajhig ]],
|
||||
[[ bbbbb aaaaajhi ]],
|
||||
[[ bbbbb aaaaajh ]],
|
||||
[[ bbbb aaaaa ]],
|
||||
[[ ]],
|
||||
[[ a a a b b b ]],
|
||||
})
|
||||
header.type = "text"
|
||||
header.opts.position = "center"
|
||||
|
||||
local vim_version = {
|
||||
type = "text",
|
||||
@ -169,18 +225,19 @@ return {
|
||||
end
|
||||
local opts = {
|
||||
layout = {
|
||||
padding(8),
|
||||
padding(10),
|
||||
header,
|
||||
padding(1),
|
||||
vim_version,
|
||||
padding(2),
|
||||
padding(1),
|
||||
datetime,
|
||||
padding(1),
|
||||
plugin_info,
|
||||
padding(1),
|
||||
plugins_loaded,
|
||||
padding(2),
|
||||
padding(1),
|
||||
buttons,
|
||||
padding(2),
|
||||
padding(1),
|
||||
fortune,
|
||||
},
|
||||
opts = { margin = 5 },
|
||||
|
Loading…
Reference in New Issue
Block a user