breaking: colors_map return a map-like table instead of list
This commit is contained in:
@@ -46,33 +46,33 @@ end
|
|||||||
local function to_iterm(colorscheme)
|
local function to_iterm(colorscheme)
|
||||||
local specs, term = unpack(colorscheme)
|
local specs, term = unpack(colorscheme)
|
||||||
local colors = {
|
local colors = {
|
||||||
["Ansi 0"] = term[1],
|
["Ansi 0"] = term.black,
|
||||||
["Ansi 1"] = term[2],
|
["Ansi 1"] = term.red,
|
||||||
["Ansi 2"] = term[3],
|
["Ansi 2"] = term.green,
|
||||||
["Ansi 3"] = term[4],
|
["Ansi 3"] = term.yellow,
|
||||||
["Ansi 4"] = term[5],
|
["Ansi 4"] = term.blue,
|
||||||
["Ansi 5"] = term[6],
|
["Ansi 5"] = term.magenta,
|
||||||
["Ansi 6"] = term[7],
|
["Ansi 6"] = term.cyan,
|
||||||
["Ansi 7"] = term[8],
|
["Ansi 7"] = term.white,
|
||||||
["Ansi 8"] = term[9],
|
["Ansi 8"] = term.bright_black,
|
||||||
["Ansi 9"] = term[10],
|
["Ansi 9"] = term.bright_red,
|
||||||
["Ansi 10"] = term[11],
|
["Ansi 10"] = term.bright_green,
|
||||||
["Ansi 11"] = term[12],
|
["Ansi 11"] = term.bright_yellow,
|
||||||
["Ansi 12"] = term[13],
|
["Ansi 12"] = term.bright_blue,
|
||||||
["Ansi 13"] = term[14],
|
["Ansi 13"] = term.bright_magenta,
|
||||||
["Ansi 14"] = term[15],
|
["Ansi 14"] = term.bright_cyan,
|
||||||
["Ansi 15"] = term[16],
|
["Ansi 15"] = term.bright_white,
|
||||||
Foreground = specs.Normal.fg,
|
["Foreground"] = specs.Normal.fg,
|
||||||
Background = specs.Normal.bg,
|
["Background"] = specs.Normal.bg,
|
||||||
Bold = term[9],
|
["Bold"] = term.bright_black,
|
||||||
Cursor = specs.Cursor.bg,
|
["Cursor"] = specs.Cursor.bg,
|
||||||
["Cursor Text"] = specs.Cursor.fg,
|
["Cursor Text"] = specs.Cursor.fg,
|
||||||
["Cursor Guide"] = specs.CursorLine.bg,
|
["Cursor Guide"] = specs.CursorLine.bg,
|
||||||
Link = term[13],
|
["Link"] = term.bright_blue,
|
||||||
Selection = specs.Visual.bg,
|
["Selection"] = specs.Visual.bg,
|
||||||
["Selected Text"] = specs.Normal.fg,
|
["Selected Text"] = specs.Normal.fg,
|
||||||
Badge = specs.Comment.fg,
|
["Badge"] = specs.Comment.fg,
|
||||||
Tab = specs.Normal.bg,
|
["Tab"] = specs.Normal.bg,
|
||||||
}
|
}
|
||||||
|
|
||||||
local template = start_template
|
local template = start_template
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ run(
|
|||||||
author = "Michael Chris Lopez",
|
author = "Michael Chris Lopez",
|
||||||
license = "MIT",
|
license = "MIT",
|
||||||
upstream = string.format("https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/%s.conf", name),
|
upstream = string.format("https://github.com/mcchrish/zenbones.nvim/raw/main/extras/kitty/%s.conf", name),
|
||||||
url_color = term[13],
|
url_color = term.bright_magenta,
|
||||||
tab_active_bg = specs.Search.bg,
|
tab_active_bg = specs.Search.bg,
|
||||||
tab_active_fg = colors.fg,
|
tab_active_fg = colors.fg,
|
||||||
tab_inactive_bg = specs.StatusLine.bg,
|
tab_inactive_bg = specs.StatusLine.bg,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local template = [[function! zenbones#generated#$name#load() abort
|
local template = [[function! zenbones#generated#$name#load() abort
|
||||||
$termcolors
|
$termcolors
|
||||||
|
|
||||||
$vimcolors
|
$vimcolors
|
||||||
|
|
||||||
let s:italics = (&t_ZH != '' && &t_ZH != '[7m') || has('gui_running') || has('nvim')
|
let s:italics = (&t_ZH != '' && &t_ZH != '[7m') || has('gui_running') || has('nvim')
|
||||||
@@ -15,9 +16,28 @@ local function to_vim_autoload(colorscheme)
|
|||||||
local vimcolors, term, name = unpack(colorscheme)
|
local vimcolors, term, name = unpack(colorscheme)
|
||||||
local termcolors = ""
|
local termcolors = ""
|
||||||
for i, v in ipairs(term) do
|
for i, v in ipairs(term) do
|
||||||
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v.hex)
|
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
termcolors = table.concat({
|
||||||
|
string.format("let g:terminal_color_0 = '%s'", term.black),
|
||||||
|
string.format("let g:terminal_color_1 = '%s'", term.red),
|
||||||
|
string.format("let g:terminal_color_2 = '%s'", term.green),
|
||||||
|
string.format("let g:terminal_color_3 = '%s'", term.yellow),
|
||||||
|
string.format("let g:terminal_color_4 = '%s'", term.blue),
|
||||||
|
string.format("let g:terminal_color_5 = '%s'", term.magenta),
|
||||||
|
string.format("let g:terminal_color_6 = '%s'", term.cyan),
|
||||||
|
string.format("let g:terminal_color_7 = '%s'", term.white),
|
||||||
|
string.format("let g:terminal_color_8 = '%s'", term.bright_black),
|
||||||
|
string.format("let g:terminal_color_9 = '%s'", term.bright_red),
|
||||||
|
string.format("let g:terminal_color_10 = '%s'", term.bright_green),
|
||||||
|
string.format("let g:terminal_color_11 = '%s'", term.bright_yellow),
|
||||||
|
string.format("let g:terminal_color_12 = '%s'", term.bright_blue),
|
||||||
|
string.format("let g:terminal_color_13 = '%s'", term.bright_magenta),
|
||||||
|
string.format("let g:terminal_color_14 = '%s'", term.bright_cyan),
|
||||||
|
string.format("let g:terminal_color_15 = '%s'", term.bright_white),
|
||||||
|
}, "\n")
|
||||||
|
|
||||||
local text = helpers.apply_template(template, {
|
local text = helpers.apply_template(template, {
|
||||||
name = name,
|
name = name,
|
||||||
termcolors = termcolors,
|
termcolors = termcolors,
|
||||||
|
|||||||
@@ -3,30 +3,14 @@ local M = {}
|
|||||||
M.colorscheme_to_term_colors = function(colorscheme)
|
M.colorscheme_to_term_colors = function(colorscheme)
|
||||||
local specs, _, term = unpack(colorscheme)
|
local specs, _, term = unpack(colorscheme)
|
||||||
local fg = specs.Normal.fg
|
local fg = specs.Normal.fg
|
||||||
return {
|
return vim.tbl_extend("keep", {
|
||||||
fg = fg,
|
fg = fg,
|
||||||
bg = specs.Normal.bg,
|
bg = specs.Normal.bg,
|
||||||
cursor_fg = specs.Cursor.fg,
|
cursor_fg = specs.Cursor.fg,
|
||||||
cursor_bg = specs.Cursor.bg,
|
cursor_bg = specs.Cursor.bg,
|
||||||
selection_bg = specs.Visual.bg,
|
selection_bg = specs.Visual.bg,
|
||||||
selection_fg = fg,
|
selection_fg = fg,
|
||||||
black = term[1],
|
}, term)
|
||||||
red = term[2],
|
|
||||||
green = term[3],
|
|
||||||
yellow = term[4],
|
|
||||||
blue = term[5],
|
|
||||||
magenta = term[6],
|
|
||||||
cyan = term[7],
|
|
||||||
white = term[8],
|
|
||||||
bright_black = term[9],
|
|
||||||
bright_red = term[10],
|
|
||||||
bright_green = term[11],
|
|
||||||
bright_yellow = term[12],
|
|
||||||
bright_blue = term[13],
|
|
||||||
bright_magenta = term[14],
|
|
||||||
bright_cyan = term[15],
|
|
||||||
bright_white = term[16],
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -1,31 +1,48 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
---@param p table
|
||||||
|
---@return table
|
||||||
function M.colors_map(p)
|
function M.colors_map(p)
|
||||||
return {
|
return {
|
||||||
p.bg,
|
black = p.bg,
|
||||||
p.rose,
|
red = p.rose,
|
||||||
p.leaf,
|
green = p.leaf,
|
||||||
p.wood,
|
yellow = p.wood,
|
||||||
p.water,
|
blue = p.water,
|
||||||
p.blossom,
|
magenta = p.blossom,
|
||||||
p.sky,
|
cyan = p.sky,
|
||||||
p.fg,
|
white = p.fg,
|
||||||
p.bg1,
|
bright_black = p.bg1,
|
||||||
p.rose1,
|
bright_red = p.rose1,
|
||||||
p.leaf1,
|
bright_green = p.leaf1,
|
||||||
p.wood1,
|
bright_yellow = p.wood1,
|
||||||
p.water1,
|
bright_blue = p.water1,
|
||||||
p.blossom1,
|
bright_magenta = p.blossom1,
|
||||||
p.sky1,
|
bright_cyan = p.sky1,
|
||||||
p.fg1,
|
bright_white = p.fg1,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param p table
|
||||||
|
---@return nil
|
||||||
function M.apply_colors(p)
|
function M.apply_colors(p)
|
||||||
local colors = M.colors_map(p)
|
local colors = M.colors_map(p)
|
||||||
for i, v in ipairs(colors) do
|
vim.g.terminal_color_0 = colors.black.hex
|
||||||
vim.g["terminal_color_" .. (i - 1)] = v.hex
|
vim.g.terminal_color_1 = colors.red.hex
|
||||||
end
|
vim.g.terminal_color_2 = colors.green.hex
|
||||||
|
vim.g.terminal_color_3 = colors.yellow.hex
|
||||||
|
vim.g.terminal_color_4 = colors.blue.hex
|
||||||
|
vim.g.terminal_color_5 = colors.magenta.hex
|
||||||
|
vim.g.terminal_color_6 = colors.cyan.hex
|
||||||
|
vim.g.terminal_color_7 = colors.white.hex
|
||||||
|
vim.g.terminal_color_8 = colors.bright_black.hex
|
||||||
|
vim.g.terminal_color_9 = colors.bright_red.hex
|
||||||
|
vim.g.terminal_color_10 = colors.bright_green.hex
|
||||||
|
vim.g.terminal_color_11 = colors.bright_yellow.hex
|
||||||
|
vim.g.terminal_color_12 = colors.bright_blue.hex
|
||||||
|
vim.g.terminal_color_13 = colors.bright_magenta.hex
|
||||||
|
vim.g.terminal_color_14 = colors.bright_cyan.hex
|
||||||
|
vim.g.terminal_color_15 = colors.bright_white.hex
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user