refactor lualine resolution
- create util to determine theme just by the name - read config from colorschemes.json
This commit is contained in:
@@ -1,34 +1 @@
|
|||||||
-- This file is auto-generated by shipwright.nvim
|
return require("zenbones.util").get_lualine_theme("duckbones")
|
||||||
local common_fg = "#9A9FBC"
|
|
||||||
local inactive_bg = "#222536"
|
|
||||||
local inactive_fg = "#F0F5C4"
|
|
||||||
|
|
||||||
return {
|
|
||||||
normal = {
|
|
||||||
a = { bg = "#5C6489", fg = common_fg, gui = "bold" },
|
|
||||||
b = { bg = "#3C415B", fg = common_fg },
|
|
||||||
c = { bg = "#2B2F44", fg = "#EBEFC0" },
|
|
||||||
},
|
|
||||||
|
|
||||||
insert = {
|
|
||||||
a = { bg = "#2A3E48", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
command = {
|
|
||||||
a = { bg = "#4D3191", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
visual = {
|
|
||||||
a = { bg = "#37382D", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
replace = {
|
|
||||||
a = { bg = "#311C1A", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive = {
|
|
||||||
a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" },
|
|
||||||
b = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
c = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.forestbones_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("forestbones")
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.neobones_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("neobones")
|
||||||
|
|||||||
@@ -1,34 +1 @@
|
|||||||
-- This file is auto-generated by shipwright.nvim
|
return require("zenbones.util").get_lualine_theme("nordbones")
|
||||||
local common_fg = "#A8B1C5"
|
|
||||||
local inactive_bg = "#414959"
|
|
||||||
local inactive_fg = "#F2F4F7"
|
|
||||||
|
|
||||||
return {
|
|
||||||
normal = {
|
|
||||||
a = { bg = "#727F98", fg = common_fg, gui = "bold" },
|
|
||||||
b = { bg = "#576175", fg = common_fg },
|
|
||||||
c = { bg = "#485061", fg = "#EBEEF3" },
|
|
||||||
},
|
|
||||||
|
|
||||||
insert = {
|
|
||||||
a = { bg = "#476968", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
command = {
|
|
||||||
a = { bg = "#84637E", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
visual = {
|
|
||||||
a = { bg = "#545F70", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
replace = {
|
|
||||||
a = { bg = "#663A3E", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive = {
|
|
||||||
a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" },
|
|
||||||
b = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
c = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes." .. vim.g.randombones_colors_name)
|
return require("zenbones.util").get_lualine_theme(vim.g.randombones_colors_name)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.rosebones_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("rosebones")
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.seoulbones_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("seoulbones")
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.tokyobones_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("tokyobones")
|
||||||
|
|||||||
@@ -1,34 +1 @@
|
|||||||
-- This file is auto-generated by shipwright.nvim
|
return require("zenbones.util").get_lualine_theme("vimbones")
|
||||||
local common_fg = "#515143"
|
|
||||||
local inactive_bg = "#D6D6B5"
|
|
||||||
local inactive_fg = "#686868"
|
|
||||||
|
|
||||||
return {
|
|
||||||
normal = {
|
|
||||||
a = { bg = "#A7A78D", fg = common_fg, gui = "bold" },
|
|
||||||
b = { bg = "#BABB9D", fg = common_fg },
|
|
||||||
c = { bg = "#CBCBAB", fg = "#353535" },
|
|
||||||
},
|
|
||||||
|
|
||||||
insert = {
|
|
||||||
a = { bg = "#A9BED1", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
command = {
|
|
||||||
a = { bg = "#DEB9D6", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
visual = {
|
|
||||||
a = { bg = "#D7D7D7", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
replace = {
|
|
||||||
a = { bg = "#EBD8DA", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive = {
|
|
||||||
a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" },
|
|
||||||
b = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
c = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.zenbones_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("zenbones")
|
||||||
|
|||||||
@@ -1,34 +1 @@
|
|||||||
-- This file is auto-generated by shipwright.nvim
|
return require("zenbones.util").get_lualine_theme("zenburned")
|
||||||
local common_fg = "#B6B6B6"
|
|
||||||
local inactive_bg = "#525252"
|
|
||||||
local inactive_fg = "#F5EDE0"
|
|
||||||
|
|
||||||
return {
|
|
||||||
normal = {
|
|
||||||
a = { bg = "#868686", fg = common_fg, gui = "bold" },
|
|
||||||
b = { bg = "#6A6A6A", fg = common_fg },
|
|
||||||
c = { bg = "#5C5C5C", fg = "#F0E4CF" },
|
|
||||||
},
|
|
||||||
|
|
||||||
insert = {
|
|
||||||
a = { bg = "#53738B", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
command = {
|
|
||||||
a = { bg = "#9C6992", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
visual = {
|
|
||||||
a = { bg = "#746956", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
replace = {
|
|
||||||
a = { bg = "#764544", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive = {
|
|
||||||
a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" },
|
|
||||||
b = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
c = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
-- This file is auto-generated from lua/zenbones/template/lualine.lua
|
|
||||||
local common_fg = "#AFA099"
|
|
||||||
local inactive_bg = "#322D2B"
|
|
||||||
local inactive_fg = "#CAD0D4"
|
|
||||||
|
|
||||||
return {
|
|
||||||
normal = {
|
|
||||||
a = { bg = "#736863", fg = common_fg, gui = "bold" },
|
|
||||||
b = { bg = "#4F4844", fg = common_fg },
|
|
||||||
c = { bg = "#3E3835", fg = "#B4BDC3" },
|
|
||||||
},
|
|
||||||
|
|
||||||
insert = {
|
|
||||||
a = { bg = "#324757", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
command = {
|
|
||||||
a = { bg = "#65435E", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
visual = {
|
|
||||||
a = { bg = "#3D4042", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
replace = {
|
|
||||||
a = { bg = "#3E2225", fg = common_fg, gui = "bold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive = {
|
|
||||||
a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" },
|
|
||||||
b = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
c = { bg = inactive_bg, fg = inactive_fg },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1 +1 @@
|
|||||||
return require("lualine.themes.zenwritten_" .. vim.opt.background:get())
|
return require("zenbones.util").get_lualine_theme("zenwritten")
|
||||||
|
|||||||
@@ -3,13 +3,48 @@ local M = {}
|
|||||||
--- Apply a zenbones colorscheme based on g:colors_name and &background.
|
--- Apply a zenbones colorscheme based on g:colors_name and &background.
|
||||||
---@return nil
|
---@return nil
|
||||||
function M.apply_colorscheme()
|
function M.apply_colorscheme()
|
||||||
local colors_name = vim.api.nvim_get_var "colors_name"
|
local colors_name = vim.g.colors_name
|
||||||
package.loaded[colors_name] = nil
|
package.loaded[colors_name] = nil
|
||||||
require "lush"(require(colors_name), { force_clean = false })
|
require "lush"(require(colors_name), { force_clean = false })
|
||||||
local p = require(colors_name .. ".palette")[vim.opt.background:get()]
|
local p = require(colors_name .. ".palette")[vim.opt.background:get()]
|
||||||
require("zenbones.term").apply_colors(p)
|
require("zenbones.term").apply_colors(p)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.get_colorscheme_list()
|
||||||
|
local json_decode = vim.fn.has "nvim-0.6.0" == 1 and vim.json.decode or vim.fn.json_decode
|
||||||
|
local file = io.open(vim.api.nvim_get_runtime_file("colorschemes.json", false)[1], "r")
|
||||||
|
local content = file:read "*a"
|
||||||
|
file:close()
|
||||||
|
return json_decode(content)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_colorscheme(name)
|
||||||
|
local colorschemes = M.get_colorscheme_list()
|
||||||
|
local colorscheme = nil
|
||||||
|
for _, c in ipairs(colorschemes) do
|
||||||
|
if c.name == name then
|
||||||
|
colorscheme = c
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if colorscheme == nil then
|
||||||
|
error(string.format("Invalid name %s", name))
|
||||||
|
end
|
||||||
|
return colorscheme
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_lualine_theme(name)
|
||||||
|
local colorscheme = M.get_colorscheme(name)
|
||||||
|
local ness_config = vim.g[name] and vim.g[name][string.format("%sness", colorscheme.background)]
|
||||||
|
or vim.g[string.format("%s_%sness", name, colorscheme.background)]
|
||||||
|
local ness = ness_config or "default"
|
||||||
|
|
||||||
|
if colorscheme.background then
|
||||||
|
return require(string.format("lualine.themes.%s_%s", name, ness))
|
||||||
|
else
|
||||||
|
return require(string.format("lualine.themes.%s_%s_%s", name, vim.opt.background:get(), ness))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Auto-fill a palette with the default palette.
|
--- Auto-fill a palette with the default palette.
|
||||||
---@param p table palette
|
---@param p table palette
|
||||||
---@param base_bg string light or dark
|
---@param base_bg string light or dark
|
||||||
|
|||||||
Reference in New Issue
Block a user