diff --git a/lua/zenbones/shipwright/init.lua b/lua/zenbones/shipwright/init.lua
index 93f8d86..ce798af 100644
--- a/lua/zenbones/shipwright/init.lua
+++ b/lua/zenbones/shipwright/init.lua
@@ -56,7 +56,7 @@ local function make_runners(config)
end
M.run = function()
- local runner_files = { "vim", "alacritty", "kitty", "wezterm", "tmux", "lualine", "lightline" }
+ local runner_files = { "vim", "iterm", "alacritty", "kitty", "wezterm", "tmux", "lualine", "lightline" }
local colorschemes = {
{ name = "zenbones" },
{ name = "neobones" },
diff --git a/lua/zenbones/shipwright/runners/iterm.lua b/lua/zenbones/shipwright/runners/iterm.lua
new file mode 100644
index 0000000..99bd9d8
--- /dev/null
+++ b/lua/zenbones/shipwright/runners/iterm.lua
@@ -0,0 +1,95 @@
+local util = require "zenbones.util"
+
+local key_template = [[
+ ${k} Color
+]]
+local color_template = [[
+
+ Alpha Component
+ 1
+ Blue Component
+ ${b}
+ Color Space
+ sRGB
+ Green Component
+ ${g}
+ Red Component
+ ${r}
+ ]]
+
+local start_template = [[
+
+
+
+]]
+local end_template = [[
+
+
+]]
+
+local function hex_to_rgb(hex)
+ local _, r, g, b = hex:match "(.)(..)(..)(..)"
+ r, g, b =
+ string.format("%0.16f", (tonumber(r, 16) / 255)),
+ string.format("%0.16f", (tonumber(g, 16) / 255)),
+ string.format("%0.16f", (tonumber(b, 16) / 255))
+ return { r = r, g = g, b = b }
+end
+
+local function key_to_xml(key, color)
+ local xml = util.interp(key_template, { k = key })
+ local rgb = hex_to_rgb(color.hex)
+ xml = xml .. util.interp(color_template, rgb)
+ return xml
+end
+
+local function to_iterm(colorscheme)
+ local specs, term = unpack(colorscheme)
+ local colors = {
+ ["Ansi 0"] = term[1],
+ ["Ansi 1"] = term[2],
+ ["Ansi 2"] = term[3],
+ ["Ansi 3"] = term[4],
+ ["Ansi 4"] = term[5],
+ ["Ansi 5"] = term[6],
+ ["Ansi 6"] = term[7],
+ ["Ansi 7"] = term[8],
+ ["Ansi 8"] = term[9],
+ ["Ansi 9"] = term[10],
+ ["Ansi 10"] = term[11],
+ ["Ansi 11"] = term[12],
+ ["Ansi 12"] = term[13],
+ ["Ansi 13"] = term[14],
+ ["Ansi 14"] = term[15],
+ ["Ansi 15"] = term[16],
+ Foreground = specs.Normal.fg,
+ Background = specs.Normal.bg,
+ Bold = term[9],
+ Cursor = specs.Cursor.bg,
+ ["Cursor Text"] = specs.Cursor.fg,
+ ["Cursor Guide"] = specs.CursorLine.bg,
+ Link = term[13],
+ Selection = specs.Visual.bg,
+ ["Selected Text"] = specs.Normal.fg,
+ Badge = specs.Comment.fg,
+ Tab = specs.Normal.bg,
+ }
+
+ local template = start_template
+
+ local xml_compiled = {}
+ for k, c in pairs(colors) do
+ table.insert(xml_compiled, key_to_xml(k, c))
+ end
+
+ template = template .. table.concat(vim.fn.sort(xml_compiled), "\n")
+ template = template .. end_template
+
+ return { template }
+end
+
+run(
+ { specs, term },
+ to_iterm,
+ { overwrite, string.format("extras/iterm/%s.itermcolors", name) }
+)