diff --git a/lua/zenbones/shipwright/init.lua b/lua/zenbones/shipwright/init.lua index afbacf2..c70cfcb 100644 --- a/lua/zenbones/shipwright/init.lua +++ b/lua/zenbones/shipwright/init.lua @@ -55,7 +55,7 @@ local function make_runners(config) end M.run = function() - local runner_files = { "alacritty", "kitty", "wezterm" } + local runner_files = { "alacritty", "kitty", "wezterm", "lualine" } local colorschemes = { { name = "zenbones" }, { name = "neobones" }, diff --git a/lua/zenbones/shipwright/runners/lualine.lua b/lua/zenbones/shipwright/runners/lualine.lua new file mode 100644 index 0000000..9243aa5 --- /dev/null +++ b/lua/zenbones/shipwright/runners/lualine.lua @@ -0,0 +1,83 @@ +local template = [[local common_fg = "$common_fg" +local inactive_bg = "$inactive_bg" +local inactive_fg = "$inactive_fg" + +return { + normal = { + a = { bg = "$normal_a_bg", fg = common_fg, gui = "bold" }, + b = { bg = "$normal_b_bg", fg = common_fg }, + c = { bg = "$normal_c_bg", fg = "$normal_c_fg" }, + }, + + insert = { + a = { bg = "$insert_a_bg", fg = common_fg, gui = "bold" }, + }, + + command = { + a = { bg = "$command_a_bg", fg = common_fg, gui = "bold" }, + }, + + visual = { + a = { bg = "$visual_a_bg", fg = common_fg, gui = "bold" }, + }, + + replace = { + a = { bg = "$replace_a_bg", 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 }, + }, +} +]] + +local helpers = require "shipwright.transform.helpers" + +local check_keys = { + "common_fg", + "inactive_bg", + "inactive_fg", + "normal_a_bg", + "normal_b_bg", + "normal_c_bg", + "normal_c_fg", + "insert_a_bg", + "command_a_bg", + "visual_a_bg", + "replace_a_bg", +} + +local function transform(colors) + for _, key in ipairs(check_keys) do + assert(colors[key], "lualine colors table missing key: " .. key) + end + + local text = helpers.apply_template(template, colors) + return helpers.split_newlines(text) +end + +local function specs_to_colors(specs) + return { + common_fg = specs.Folded.fg.hex, + inactive_bg = specs.StatusLineNC.bg.hex, + inactive_fg = specs.StatusLineNC.fg.hex, + normal_a_bg = specs.PmenuSbar.bg.hex, + normal_b_bg = specs.PmenuSel.bg.hex, + normal_c_bg = specs.StatusLine.bg.hex, + normal_c_fg = specs.StatusLine.fg.hex, + insert_a_bg = specs.DiffText.bg.hex, + command_a_bg = specs.Search.bg.hex, + visual_a_bg = specs.Visual.bg.hex, + replace_a_bg = specs.DiffDelete.bg.hex, + } +end + +run( + specs, + specs_to_colors, + transform, + { prepend, "-- This file is auto-generated by shipwright.nvim" }, + { overwrite, string.format("lua/lualine/themes/%s.lua", name) } +)