From bc872970b2ca98accfdf6786c099678b41c64b9d Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:08:33 -0400 Subject: [PATCH 01/19] feat(extras): add Alacritty theme --- lua/astrotheme/extras/alacritty.lua | 51 +++++++++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 1 + 2 files changed, 52 insertions(+) create mode 100644 lua/astrotheme/extras/alacritty.lua diff --git a/lua/astrotheme/extras/alacritty.lua b/lua/astrotheme/extras/alacritty.lua new file mode 100644 index 0000000..4aed042 --- /dev/null +++ b/lua/astrotheme/extras/alacritty.lua @@ -0,0 +1,51 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [=[ +# AstroTheme Alacritty Colors +# Default colors +[colors.primary] +background = '${ui.base}' +foreground = '${ui.text}' + +# Normal colors +[colors.normal] +black = '${term.black}' +red = '${term.red}' +green = '${term.green}' +yellow = '${term.yellow}' +blue = '${term.blue}' +magenta = '${term.purple}' +cyan = '${term.cyan}' +white = '${term.white}' + +# Bright colors +[colors.bright] +black = '${term.bright_black}' +red = '${term.bright_red}' +green = '${term.bright_green}' +yellow = '${term.bright_yellow}' +blue = '${term.bright_blue}' +magenta = '${term.bright_purple}' +cyan = '${term.bright_cyan}' +white = '${term.bright_white}' + +# Indexed Colors +[[colors.indexed_colors]] +index = 16 +color = '${ui.orange}' + +[[colors.indexed_colors]] +index = 17 +color = '${ui.red}' + +]=], + colors + ) +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 84c9439..e580024 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -12,6 +12,7 @@ M.extras = { lua = { ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing" }, vim = { ext = "vim", url = "https://vimhelp.org/", label = "Vim", subdir = "colors"}, wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, + alacritty = { ext = "toml", url = "https://github.com/alacritty/alacritty", label = "Alacritty" }, } function M.setup() From 5eb602990aa53fca3bfc3df2089bf6f31b3b4235 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:09:35 -0400 Subject: [PATCH 02/19] feat(extras): add Delta theme --- lua/astrotheme/extras/delta.lua | 26 ++++++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 1 + 2 files changed, 27 insertions(+) create mode 100644 lua/astrotheme/extras/delta.lua diff --git a/lua/astrotheme/extras/delta.lua b/lua/astrotheme/extras/delta.lua new file mode 100644 index 0000000..b12f418 --- /dev/null +++ b/lua/astrotheme/extras/delta.lua @@ -0,0 +1,26 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +[delta] + minus-style = syntax "${syntax.red}" + minus-non-emph-style = syntax "${syntax.red}" + minus-emph-style = syntax "${ui.red}" + minus-empty-line-marker-style = syntax "${syntax.red}" + line-numbers-minus-style = "syntax.red" + plus-style = syntax "${syntax.green}" + plus-non-emph-style = syntax "${syntax.green}" + plus-emph-style = syntax "${ui.green}" + plus-empty-line-marker-style = syntax "${syntax.green}" + line-numbers-plus-style = "syntax.green" + line-numbers-zero-style = "${ui.base}" +]], + colors + ) +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index e580024..ecca7a2 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -13,6 +13,7 @@ M.extras = { vim = { ext = "vim", url = "https://vimhelp.org/", label = "Vim", subdir = "colors"}, wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, alacritty = { ext = "toml", url = "https://github.com/alacritty/alacritty", label = "Alacritty" }, + delta = { ext = "gitconfig", url = "https://github.com/dandavison/delta", label = "Delta" }, } function M.setup() From deacdc0cbb2b161a17cbdfea1482b87fb19f86d6 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:09:51 -0400 Subject: [PATCH 03/19] feat(extras): add Dunst theme --- lua/astrotheme/extras/dunst.lua | 31 +++++++++++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 1 + 2 files changed, 32 insertions(+) create mode 100644 lua/astrotheme/extras/dunst.lua diff --git a/lua/astrotheme/extras/dunst.lua b/lua/astrotheme/extras/dunst.lua new file mode 100644 index 0000000..778d66c --- /dev/null +++ b/lua/astrotheme/extras/dunst.lua @@ -0,0 +1,31 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +# ${_style_name} colors for dunst +# For more configuration options see https://github.com/dunst-project/dunst/blob/master/dunstrc + +[urgency_low] + background = "${ui.inactive_base}" + foreground = "${syntax.text}" + frame_color = "${ui.border}" + +[urgency_normal] + background = "${ui.base}" + foreground = "${syntax.text}" + frame_color = "${ui.border}" + +[urgency_critical] + background = "${ui.highlight}" + foreground = "${syntax.red}" + frame_color = "${syntax.red}" +]], + colors + ) +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index ecca7a2..ee0c469 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -14,6 +14,7 @@ M.extras = { wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, alacritty = { ext = "toml", url = "https://github.com/alacritty/alacritty", label = "Alacritty" }, delta = { ext = "gitconfig", url = "https://github.com/dandavison/delta", label = "Delta" }, + dunst = { ext = "dunstrc", url = "https://dunst-project.org/", label = "Dunst" }, } function M.setup() From df7ab86a7a2e9ba84613ecf46f4e3ad96796b255 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:10:09 -0400 Subject: [PATCH 04/19] feat(extras): add Fish themes --- lua/astrotheme/extras/fish.lua | 55 +++++++++++++++++++++++++++ lua/astrotheme/extras/fish_themes.lua | 45 ++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 2 + 3 files changed, 102 insertions(+) create mode 100644 lua/astrotheme/extras/fish.lua create mode 100644 lua/astrotheme/extras/fish_themes.lua diff --git a/lua/astrotheme/extras/fish.lua b/lua/astrotheme/extras/fish.lua new file mode 100644 index 0000000..8c0ed47 --- /dev/null +++ b/lua/astrotheme/extras/fish.lua @@ -0,0 +1,55 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + local function normalize_colors(_colors) + local new_colors = {} + for k, v in pairs(_colors) do + new_colors[k] = type(v) == "string" and v:gsub("^#", "") or normalize_colors(v) + end + return new_colors + end + return util.template( + [[ + # ${_style_name} Color Palette + set -l foreground ${syntax.text} + set -l selection ${ui.selection} + set -l comment ${syntax.comment} + set -l red ${syntax.red} + set -l orange ${syntax.orange} + set -l yellow ${syntax.yellow} + set -l green ${syntax.green} + set -l purple ${syntax.purple} + set -l cyan ${syntax.cyan} + set -l pink ${syntax.purple} + + # Syntax Highlighting Colors + set -g fish_color_normal $foreground + set -g fish_color_command $cyan + set -g fish_color_keyword $pink + set -g fish_color_quote $yellow + set -g fish_color_redirection $foreground + set -g fish_color_end $orange + set -g fish_color_error $red + set -g fish_color_param $purple + set -g fish_color_comment $comment + set -g fish_color_selection --background=$selection + set -g fish_color_search_match --background=$selection + set -g fish_color_operator $green + set -g fish_color_escape $pink + set -g fish_color_autosuggestion $comment + + # Completion Pager Colors + set -g fish_pager_color_progress $comment + set -g fish_pager_color_prefix $cyan + set -g fish_pager_color_completion $foreground + set -g fish_pager_color_description $comment + set -g fish_pager_color_selected_background --background=$selection +]], + normalize_colors(colors) + ) +end + +return M diff --git a/lua/astrotheme/extras/fish_themes.lua b/lua/astrotheme/extras/fish_themes.lua new file mode 100644 index 0000000..36f277e --- /dev/null +++ b/lua/astrotheme/extras/fish_themes.lua @@ -0,0 +1,45 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + local function normalize_colors(_colors) + local new_colors = {} + for k, v in pairs(_colors) do + new_colors[k] = type(v) == "string" and v:gsub("^#", "") or normalize_colors(v) + end + return new_colors + end + return util.template( + [[ + # ${_style_name} + + # Syntax Highlighting Colors + fish_color_normal ${syntax.text} + fish_color_command ${syntax.cyan} + fish_color_keyword ${syntax.purple} + fish_color_quote ${syntax.yellow} + fish_color_redirection ${syntax.text} + fish_color_end ${syntax.orange} + fish_color_error ${syntax.red} + fish_color_param ${syntax.purple} + fish_color_comment ${syntax.comment} + fish_color_selection --background=${ui.selection} + fish_color_search_match --background=${ui.selection} + fish_color_operator ${syntax.green} + fish_color_escape ${syntax.purple} + fish_color_autosuggestion ${syntax.comment} + + # Completion Pager Colors + fish_pager_color_progress ${syntax.comment} + fish_pager_color_prefix ${syntax.cyan} + fish_pager_color_completion ${syntax.text} + fish_pager_color_description ${syntax.comment} + fish_pager_color_selected_background --background=${ui.selection} +]], + normalize_colors(colors) + ) +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index ee0c469..6a8755d 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -15,6 +15,8 @@ M.extras = { alacritty = { ext = "toml", url = "https://github.com/alacritty/alacritty", label = "Alacritty" }, delta = { ext = "gitconfig", url = "https://github.com/dandavison/delta", label = "Delta" }, dunst = { ext = "dunstrc", url = "https://dunst-project.org/", label = "Dunst" }, + fish = { ext = "fish", url = "https://fishshell.com/docs/current/index.html", label = "Fish" }, + fish_themes = { ext = "theme", url = "https://fishshell.com/docs/current/interactive.html#syntax-highlighting", label = "Fish Themes" }, } function M.setup() From 6605c7eca2ce990f835997c4153604687c0ae850 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:10:22 -0400 Subject: [PATCH 05/19] feat(extras): add Foot theme --- lua/astrotheme/extras/foot.lua | 50 ++++++++++++++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 1 + 2 files changed, 51 insertions(+) create mode 100644 lua/astrotheme/extras/foot.lua diff --git a/lua/astrotheme/extras/foot.lua b/lua/astrotheme/extras/foot.lua new file mode 100644 index 0000000..0307356 --- /dev/null +++ b/lua/astrotheme/extras/foot.lua @@ -0,0 +1,50 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + local function normalize_colors(_colors) + local new_colors = {} + for k, v in pairs(_colors) do + new_colors[k] = type(v) == "string" and v:gsub("^#", "") or normalize_colors(v) + end + return new_colors + end + return util.template( + [[ +[cursor] +color=${syntax.text} ${ui.selection} + +[colors] +foreground=${syntax.text} +background=${ui.base} +selection-foreground=${syntax.text} +selection-background=${ui.selection} +urls=${syntax.blue} + +regular0=${term.black} +regular1=${term.red} +regular2=${term.green} +regular3=${term.yellow} +regular4=${term.blue} +regular5=${term.purple} +regular6=${term.cyan} +regular7=${term.white} + +bright0=${term.bright_black} +bright1=${term.bright_red} +bright2=${term.bright_green} +bright3=${term.bright_yellow} +bright4=${term.bright_blue} +bright5=${term.bright_purple} +bright6=${term.bright_cyan} +bright7=${term.bright_white} + +16=${ui.orange} +17=${ui.red}]], + normalize_colors(colors) + ) +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 6a8755d..986c542 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -17,6 +17,7 @@ M.extras = { dunst = { ext = "dunstrc", url = "https://dunst-project.org/", label = "Dunst" }, fish = { ext = "fish", url = "https://fishshell.com/docs/current/index.html", label = "Fish" }, fish_themes = { ext = "theme", url = "https://fishshell.com/docs/current/interactive.html#syntax-highlighting", label = "Fish Themes" }, + foot = { ext = "ini", url = "https://codeberg.org/dnkl/foot", label = "Foot" }, } function M.setup() From 889f0b7c910751ac5f118a695a2c1ac676d0c1d0 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:10:35 -0400 Subject: [PATCH 06/19] feat(extras): add GitUI theme --- lua/astrotheme/extras/gitui.lua | 37 +++++++++++++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 1 + 2 files changed, 38 insertions(+) create mode 100644 lua/astrotheme/extras/gitui.lua diff --git a/lua/astrotheme/extras/gitui.lua b/lua/astrotheme/extras/gitui.lua new file mode 100644 index 0000000..0a45246 --- /dev/null +++ b/lua/astrotheme/extras/gitui.lua @@ -0,0 +1,37 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +( + selected_tab: Some("${syntax.purple}"), + command_fg: Some("${syntax.comment}"), + selection_bg: Some("${ui.selection}"), + selection_fg: Some("${syntax.cyan}"), + cmdbar_bg: Some("${ui.base}"), + cmdbar_extra_lines_bg: Some("${ui.base}"), + disabled_fg: Some("${syntax.comment}"), + diff_line_add: Some("${syntax.green}"), + diff_line_delete: Some("${syntax.red}"), + diff_file_added: Some("${ui.green}"), + diff_file_removed: Some("${ui.red}"), + diff_file_moved: Some("${ui.purple}"), + diff_file_modified: Some("${ui.yellow}"), + commit_hash: Some("${syntax.purple}"), + commit_time: Some("${syntax.cyan}"), + commit_author: Some("${syntax.green}"), + danger_fg: Some("${ui.red}"), + push_gauge_bg: Some("${ui.base}"), + push_gauge_fg: Some("${syntax.text}"), + tag_fg: Some("${ui.purple}"), + branch_fg: Some("${ui.yellow}") +) +]], + colors + ) +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 986c542..0833c68 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -18,6 +18,7 @@ M.extras = { fish = { ext = "fish", url = "https://fishshell.com/docs/current/index.html", label = "Fish" }, fish_themes = { ext = "theme", url = "https://fishshell.com/docs/current/interactive.html#syntax-highlighting", label = "Fish Themes" }, foot = { ext = "ini", url = "https://codeberg.org/dnkl/foot", label = "Foot" }, + gitui = { ext = "ron", url = "https://github.com/extrawurst/gitui", label = "GitUI" }, } function M.setup() From e11633ccad6345272e501f2b741da01b2708c544 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:10:44 -0400 Subject: [PATCH 07/19] feat(extras): add Helix theme --- lua/astrotheme/extras/helix.lua | 430 ++++++++++++++++++++++++++++++++ lua/astrotheme/extras/init.lua | 1 + 2 files changed, 431 insertions(+) create mode 100644 lua/astrotheme/extras/helix.lua diff --git a/lua/astrotheme/extras/helix.lua b/lua/astrotheme/extras/helix.lua new file mode 100644 index 0000000..c99275c --- /dev/null +++ b/lua/astrotheme/extras/helix.lua @@ -0,0 +1,430 @@ +local M = {} + +--- @param colors AstroThemePalette +--- @param highlights table +function M.generate(colors, highlights) + -- Ref: https://github.com/helix-editor/helix/blob/master/book/src/themes.md + -- nil is used when no equivalent was found. + local mapping = M.flatten { + attribute = "@attribute", + type = { + "Type", + builtin = "@type.builtin", + enum = { + "@lsp.type.enum", + variant = "@lsp.type.enumMember", + }, + }, + -- rust: pattern matching `let Some(_) = ...` + -- ^^^^ + constructor = "Type", + constant = { + "Constant", + builtin = { + "@constant.builtin", + boolean = "Boolean", + }, + character = { + "Character", + escape = "@string.escape", + }, + numeric = { + "Number", + float = "Float", + integer = "Number", + }, + }, + string = { + "String", + regexp = "@string.regexp", + special = { + "@string.special", + path = nil, + url = nil, + symbol = nil, + }, + }, + comment = { + "@comment", + line = nil, + block = { + nil, + -- not sure about that one + documentation = "@string.documentation", + }, + }, + variable = { + "@variable", + builtin = "@variable.builtin", + parameter = "@variable.parameter", + other = { + nil, + member = "@variable.member", + }, + }, + label = "@label", + keyword = { + "@keyword", + control = { + "Statement", + conditional = "Conditional", + ["repeat"] = "Repeat", + import = nil, + ["return"] = "@keyword.return", + exception = "Exception", + }, + operator = "Statement", + directive = "PreProc", + ["function"] = "@keyword.function", + storage = { + nil, -- rust: `let` + type = nil, -- rust: `struct` & `type` + modifier = nil, -- rust: `mut` + }, + }, + operator = "Operator", + ["function"] = { + "Function", + builtin = "@function.builtin", + method = "@function.method", + macro = "@function.macro", + -- Defined as "preprocessor in C", so using "PreProc", not sure though + special = "PreProc", + }, + tag = { + "@tag", + -- ??? + builtin = nil, + }, + namespace = "@lsp.type.namespace", + special = "Special", + markup = { + nil, + heading = { + "@markup.heading", + marker = nil, + -- post-processed to remove the 'h' as we already use the first element (1) as the root value. + h1 = nil, + h2 = nil, + h3 = nil, + h4 = nil, + h5 = nil, + h6 = nil, + -- UI -- + completion = "Pmenu", + hover = "PmenuSel", + }, + list = { + "@markup.list", + unnumbered = nil, + numbered = nil, + checked = nil, + unchecked = nil, + }, + bold = "Bold", + italic = "Italic", + strikethrough = { + "helix", + modifiers = { "crossed_out" }, + }, + link = { + "@markup.link", + url = "@markup.link.url", + label = "@markup.link.label", + text = "@markup.link", + }, + quote = nil, + raw = { + "@markup.raw", + inline = "@markup.raw.markdown_inline", + block = nil, + -- UI -- + completion = nil, + hover = nil, + }, + -- UI -- + normal = { + nil, + completion = "CmpItemMenu", + hover = "CmpItemKindDefault", + }, + }, + diff = { + nil, + plus = "diffAdded", + minus = "diffRemoved", + delta = { + "diffChanged", + moved = "diffFile", + }, + }, + ui = { + background = { + { "helix", bg = "bg" }, + separator = nil, + }, + cursor = { + "Cursor", + normal = nil, + insert = nil, + select = nil, + match = "MatchParen", + primary = { + nil, + normal = nil, + insert = nil, + select = nil, + }, + }, + debug = { + breakpoint = nil, + active = nil, + }, + gutter = { + nil, + selected = nil, + }, + highlight = { + nil, + frameline = nil, + }, + linenr = { + "LineNr", + select = "CursorLineNr", + }, + statusline = { + "StatusLine", + inactive = "StatusLineNc", + -- Inspired from lualine + normal = { + "helix", + bg = "blue", + fg = "black", + }, + insert = nil, + select = nil, + separator = nil, + }, + popup = { + "TelescopeBorder", + info = nil, + }, + window = "WinSeparator", + help = nil, + text = { + "Normal", + -- TelescopeSelection + focus = "Visual", + inactive = "Comment", + info = "TelescopeNormal", + }, + virtual = { + ruler = nil, + whitespace = nil, + ["indent-guide"] = nil, + ["inlay-hint"] = { + "DiagnosticVirtualTextHint", + parameter = nil, + type = nil, + }, + wrap = nil, + }, + menu = { + "Pmenu", + selected = "PmenuSel", + scroll = { + "helix", + fg = vim.tbl_get(highlights, "PmenuThumb", "bg"), + bg = vim.tbl_get(highlights, "PmenuSbar", "bg"), + }, + }, + selection = { + { "helix", bg = "bg_highlight" }, + primary = nil, + }, + cursorline = { + primary = nil, + secondary = nil, + }, + cursorcolumn = { + primary = nil, + secondary = nil, + }, + }, + hint = "DiagnosticHint", + info = "DiagnosticInfo", + warning = "DiagnosticWarn", + error = "DiagnosticError", + diagnostic = { + nil, + hint = "DiagnosticUnderlineHint", + info = "DiagnosticUnderlineInfo", + warning = "DiagnosticUnderlineWarn", + error = "DiagnosticUnderlineError", + }, + } + + local config = {} + for hx_scope, group in M.pairsByKeys(mapping) do + -- print(hx_scope, util.dump(group)) + hx_scope = hx_scope:gsub("%.h(%d)", ".%1") + if hx_scope:match "%." then hx_scope = '"' .. hx_scope .. '"' end + + if group then + if type(group) == "table" and group[1] == "helix" then + table.remove(group, 1) + table.insert(config, string.format("%s = %s", hx_scope, M.to_toml(group))) + else + local highlight = highlights[group] + while highlight and (type(highlight) == "string" or highlight.link) do + highlight = highlights[type(highlight) == "string" and highlight or highlight.link] + end + if highlight then + table.insert(config, string.format("%s = %s", hx_scope, M.to_helix_config(highlight))) + else + print("Unknown highlight for " .. hx_scope) + end + end + end + end + + table.insert(config, "\n[palette]") + for name, color in M.pairsByKeys(M.flatten(colors)) do + if name:match "%." then name = '"' .. name .. '"' end + if type(color) == "string" and not string.starts(name, "_") and name ~= "none" then + table.insert(config, string.format('%s = "%s"', name, color)) + end + end + return table.concat(config, "\n") +end + +function string.starts(String, Start) return string.sub(String, 1, string.len(Start)) == Start end + +function M.flatten(t) + local res = {} + for k, v in pairs(t) do + if type(v) == "table" then + if v[1] ~= "helix" then + for k2, v2 in pairs(M.flatten(v)) do + -- Special case for tables like: + -- { type = { "@type", enum = "@type.enum" } } + if k2 == 1 then + res[k] = v2 + else + res[k .. "." .. k2] = v2 + end + end + else + res[k] = v + end + else + res[k] = v + end + end + return res +end + +-- https://www.lua.org/pil/19.3.html +function M.pairsByKeys(t, f) + local a = {} + for n in pairs(t) do + table.insert(a, n) + end + table.sort(a, f) + local i = 0 -- iterator variable + local iter = function() -- iterator function + i = i + 1 + if a[i] == nil then + return nil + else + return a[i], t[a[i]] + end + end + return iter +end + +function M.to_helix_config(highlight) + local style = {} + for hx_name, nvim_name in pairs { fg = "fg", bg = "bg" } do + style[hx_name] = M.to_rgb(highlight[nvim_name]) + end + local modifiers = {} + for _, mods in ipairs { highlight, highlight.cterm } do + if mods then + if mods.bold then modifiers.bold = true end + if mods.italic then modifiers.italic = true end + if mods.underline then style.underline = { + style = "line", + } end + if mods.undercurl and highlight.sp then + style.underline = { + color = M.to_rgb(mods.sp), + style = "curl", + } + end + end + end + if next(modifiers) ~= nil then style.modifiers = M.key_set(modifiers) end + return M.to_toml(style) +end + +function M.to_rgb(color) + if type(color) == "string" and color ~= "NONE" then + return color + elseif type(color) == "number" then + return string.format("#%06x", color) + end +end + +function M.key_set(t) + local keys = {} + for key, _ in pairs(t) do + table.insert(keys, key) + end + return keys +end + +function M.to_toml(style) + local buffer = {} + M.insert_as_toml(buffer, style) + return table.concat(buffer, "") +end + +function M.insert_as_toml(buffer, x) + if type(x) == "table" then + if next(x) == nil then return end + if M.is_array(x) then + table.insert(buffer, "[") + for _, v in pairs(x) do + M.insert_as_toml(buffer, v) + table.insert(buffer, ", ") + end + table.remove(buffer) + table.insert(buffer, "]") + else + table.insert(buffer, "{ ") + for k, v in M.pairsByKeys(x) do + table.insert(buffer, string.format("%s = ", k)) + M.insert_as_toml(buffer, v) + table.insert(buffer, ", ") + end + table.remove(buffer) + table.insert(buffer, " }") + end + elseif type(x) == "string" then + table.insert(buffer, '"' .. x .. '"') + elseif type(x) ~= nil then + table.insert(buffer, tostring(x)) + end +end + +function M.is_array(t) + local i = 0 + for _ in pairs(t) do + i = i + 1 + if t[i] == nil then return false end + end + return true +end + +return M diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 0833c68..1da9c84 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -19,6 +19,7 @@ M.extras = { fish_themes = { ext = "theme", url = "https://fishshell.com/docs/current/interactive.html#syntax-highlighting", label = "Fish Themes" }, foot = { ext = "ini", url = "https://codeberg.org/dnkl/foot", label = "Foot" }, gitui = { ext = "ron", url = "https://github.com/extrawurst/gitui", label = "GitUI" }, + helix = { ext = "toml", url = "https://helix-editor.com/", label = "Helix" }, } function M.setup() From ef71e48834a4674b9c946b02463acdb6a59c22c4 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:10:55 -0400 Subject: [PATCH 08/19] feat(extras): add iTerm theme --- .typos.toml | 1 + lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/iterm.lua | 108 ++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 lua/astrotheme/extras/iterm.lua diff --git a/.typos.toml b/.typos.toml index 2c97b1a..e1af238 100644 --- a/.typos.toml +++ b/.typos.toml @@ -1,5 +1,6 @@ [default.extend-words] noice = "noice" +iterm = "iterm" [files] extend-exclude = ["CHANGELOG.md"] diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 1da9c84..79306bb 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -20,6 +20,7 @@ M.extras = { foot = { ext = "ini", url = "https://codeberg.org/dnkl/foot", label = "Foot" }, gitui = { ext = "ron", url = "https://github.com/extrawurst/gitui", label = "GitUI" }, helix = { ext = "toml", url = "https://helix-editor.com/", label = "Helix" }, + iterm = { ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm" }, } function M.setup() diff --git a/lua/astrotheme/extras/iterm.lua b/lua/astrotheme/extras/iterm.lua new file mode 100644 index 0000000..8d97ce8 --- /dev/null +++ b/lua/astrotheme/extras/iterm.lua @@ -0,0 +1,108 @@ +local util = require "astrotheme.extras" + +local M = {} + +local base_component = [[ + + Alpha Component + %s + Red Component + %s + Green Component + %s + Blue Component + %s + Color Space + sRGB + ]] + +--- @param colors AstroThemePalette +function M.generate(colors) + local function calculate_component(hex, alpha) + hex, alpha = hex:gsub("^#", ""), alpha or 1 + local r = string.format("%.16f", tonumber("0x" .. hex:sub(1, 2)) / 255) + local g = string.format("%.16f", tonumber("0x" .. hex:sub(3, 4)) / 255) + local b = string.format("%.16f", tonumber("0x" .. hex:sub(5, 6)) / 255) + return base_component:format(tostring(alpha), r, g, b) + end + local function normalize_colors(_colors) + local new_colors = {} + for k, v in pairs(_colors) do + if type(v) == "table" then + new_colors[k] = normalize_colors(v) + elseif v:match "^#" then + new_colors[k] = calculate_component(v) + else + new_colors[k] = v + end + end + return new_colors + end + local iterm_colors = normalize_colors(colors) + iterm_colors.cursor_guide = calculate_component(colors.syntax.text, 0.25) + iterm_colors.badge = calculate_component(colors.ui.red, 0.5) + return util.template( + [[ + + + + + Ansi 0 Color +${term.black} + Ansi 1 Color +${term.red} + Ansi 2 Color + ${term.green} + Ansi 3 Color +${term.yellow} + Ansi 4 Color +${term.blue} + Ansi 5 Color +${term.purple} + Ansi 6 Color +${term.cyan} + Ansi 7 Color +${term.white} + Ansi 8 Color +${term.bright_black} + Ansi 9 Color +${term.bright_red} + Ansi 10 Color +${term.bright_green} + Ansi 11 Color +${term.bright_yellow} + Ansi 12 Color +${term.bright_blue} + Ansi 13 Color +${term.bright_purple} + Ansi 14 Color +${term.bright_cyan} + Ansi 15 Color +${term.bright_white} + Background Color +${ui.base} + Badge Color +${ui.badge} + Bold Color +${ui.accent} + Cursor Color +${syntax.text} + Cursor Guide Color +${cursor_guide} + Cursor Text Color +${ui.base} + Foreground Color +${syntax.text} + Link Color +${syntax.blue} + Selected Text Color +${syntax.text} + Selection Color +${ui.selection} + +]], + iterm_colors + ) +end + +return M From 4505b6126bd1550f5fed8f4cbac5da37ae2d83d2 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:11:07 -0400 Subject: [PATCH 09/19] feat(extras): add Kitty theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/kitty.lua | 63 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 lua/astrotheme/extras/kitty.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 79306bb..ace10ac 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -21,6 +21,7 @@ M.extras = { gitui = { ext = "ron", url = "https://github.com/extrawurst/gitui", label = "GitUI" }, helix = { ext = "toml", url = "https://helix-editor.com/", label = "Helix" }, iterm = { ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm" }, + kitty = { ext = "conf", url = "https://sw.kovidgoyal.net/kitty/conf.html", label = "Kitty" }, } function M.setup() diff --git a/lua/astrotheme/extras/kitty.lua b/lua/astrotheme/extras/kitty.lua new file mode 100644 index 0000000..18151fa --- /dev/null +++ b/lua/astrotheme/extras/kitty.lua @@ -0,0 +1,63 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +# vim:ft=kitty + +## name: ${_style_name} +## license: MIT +## author: AstroNvim +## upstream: ${_upstream_url} + + +background ${ui.base} +foreground ${syntax.text} +selection_background ${ui.selection} +selection_foreground ${syntax.text} +url_color ${syntax.blue} +cursor ${syntax.text} +cursor_text_color ${ui.base} + +# Tabs +active_tab_background ${ui.accent} +active_tab_foreground ${ui.base} +inactive_tab_background ${ui.base} +inactive_tab_foreground ${ui.text_inactive} + +# Windows +active_border_color ${ui.accent} +inactive_border_color ${ui.border} + +# normal +color0 ${term.black} +color1 ${term.red} +color2 ${term.green} +color3 ${term.yellow} +color4 ${term.blue} +color5 ${term.purple} +color6 ${term.cyan} +color7 ${term.white} + +# bright +color8 ${term.bright_black} +color9 ${term.bright_red} +color10 ${term.bright_green} +color11 ${term.bright_yellow} +color12 ${term.bright_blue} +color13 ${term.bright_purple} +color14 ${term.bright_cyan} +color15 ${term.bright_white} + +# extended colors +color16 ${ui.orange} +color17 ${ui.red} +]], + colors + ) +end + +return M From 003513017e743e35f776f0c27019826ab8b5947f Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:11:19 -0400 Subject: [PATCH 10/19] feat(extras): add LazyGit theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/lazygit.lua | 41 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 lua/astrotheme/extras/lazygit.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index ace10ac..693caa1 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -22,6 +22,7 @@ M.extras = { helix = { ext = "toml", url = "https://helix-editor.com/", label = "Helix" }, iterm = { ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm" }, kitty = { ext = "conf", url = "https://sw.kovidgoyal.net/kitty/conf.html", label = "Kitty" }, + lazygit = { ext = "yml", url = "https://github.com/jesseduffield/lazygit", label = "Lazygit" }, } function M.setup() diff --git a/lua/astrotheme/extras/lazygit.lua b/lua/astrotheme/extras/lazygit.lua new file mode 100644 index 0000000..3dd28d9 --- /dev/null +++ b/lua/astrotheme/extras/lazygit.lua @@ -0,0 +1,41 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +gui: + nerdFontsVersion: "3" + theme: + activeBorderColor: + - "${ui.accent}" + - "bold" + inactiveBorderColor: + - "${ui.border}" + searchingActiveBorderColor: + - "${ui.accent}" + - "bold" + optionsTextColor: + - "${syntax.blue}" + selectedLineBgColor: + - "${ui.selection}" + cherryPickedCommitFgColor: + - "${ui.base}" + cherryPickedCommitBgColor: + - "${syntax.purple}" + markedBaseCommitFgColor: + - "${ui.base}" + markedBaseCommitBgColor: + - "${syntax.yellow}" + unstagedChangesColor: + - "${syntax.red}" + defaultFgColor: + - "${syntax.text}" +]], + colors + ) +end + +return M From 8744391df8b30f6b3058a103e6fa602f11c8bfcb Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:11:35 -0400 Subject: [PATCH 11/19] feat(extras): add Slack theme --- lua/astrotheme/extras/init.lua | 3 ++- lua/astrotheme/extras/slack.lua | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 lua/astrotheme/extras/slack.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 693caa1..9b792f2 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -9,7 +9,6 @@ local M = {} -- stylua: ignore M.extras = { -- Keep all entries here aligned by the first `=` sign - lua = { ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing" }, vim = { ext = "vim", url = "https://vimhelp.org/", label = "Vim", subdir = "colors"}, wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, alacritty = { ext = "toml", url = "https://github.com/alacritty/alacritty", label = "Alacritty" }, @@ -23,6 +22,8 @@ M.extras = { iterm = { ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm" }, kitty = { ext = "conf", url = "https://sw.kovidgoyal.net/kitty/conf.html", label = "Kitty" }, lazygit = { ext = "yml", url = "https://github.com/jesseduffield/lazygit", label = "Lazygit" }, + lua = { ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing" }, + slack = {ext = "txt", url = "https://slack.com", label = "Slack"}, } function M.setup() diff --git a/lua/astrotheme/extras/slack.lua b/lua/astrotheme/extras/slack.lua new file mode 100644 index 0000000..60d9005 --- /dev/null +++ b/lua/astrotheme/extras/slack.lua @@ -0,0 +1,8 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) return util.template("${ui.border},${ui.current_line},${ui.accent},${ui.selection}", colors) end + +return M From 9b2a36a05f3858a2f3af58b5643ce9d4f1ed5fa8 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:11:48 -0400 Subject: [PATCH 12/19] feat(extras): add Spotify Player theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/spotify_player.lua | 35 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 lua/astrotheme/extras/spotify_player.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 9b792f2..acda188 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -24,6 +24,7 @@ M.extras = { lazygit = { ext = "yml", url = "https://github.com/jesseduffield/lazygit", label = "Lazygit" }, lua = { ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing" }, slack = {ext = "txt", url = "https://slack.com", label = "Slack"}, + spotify_player = {ext = "toml", url = "https://github.com/aome510/spotify-player", label = "Spotify Player"}, } function M.setup() diff --git a/lua/astrotheme/extras/spotify_player.lua b/lua/astrotheme/extras/spotify_player.lua new file mode 100644 index 0000000..e12eae6 --- /dev/null +++ b/lua/astrotheme/extras/spotify_player.lua @@ -0,0 +1,35 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [=[ +[[themes]] +name = "${_style_name}" +[themes.palette] +background = "${ui.base}" +foreground = "${syntax.text}" +black = "${term.black}" +red = "${term.red}" +green = "${term.green}" +yellow = "${term.yellow}" +blue = "${term.blue}" +magenta = "${term.purple}" +cyan = "${term.cyan}" +white = "${term.white}" +bright_black = "${term.bright_black}" +bright_red = "${term.bright_red}" +bright_green = "${term.bright_green}" +bright_yellow = "${term.bright_yellow}" +bright_blue = "${term.bright_blue}" +bright_magenta = "${term.bright_purple}" +bright_cyan = "${term.bright_cyan}" +bright_white = "${term.bright_white}" +]=], + colors + ) +end + +return M From 589adcedb1cc051c40f07c56893e8a7539db844f Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:12:00 -0400 Subject: [PATCH 13/19] feat(extras): add Terminator theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/terminator.lua | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 lua/astrotheme/extras/terminator.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index acda188..1e78ea2 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -25,6 +25,7 @@ M.extras = { lua = { ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing" }, slack = {ext = "txt", url = "https://slack.com", label = "Slack"}, spotify_player = {ext = "toml", url = "https://github.com/aome510/spotify-player", label = "Spotify Player"}, + terminator = { ext = "conf", url = "https://gnome-terminator.readthedocs.io/en/latest/config.html", label = "Terminator" }, } function M.setup() diff --git a/lua/astrotheme/extras/terminator.lua b/lua/astrotheme/extras/terminator.lua new file mode 100644 index 0000000..1d9c2a4 --- /dev/null +++ b/lua/astrotheme/extras/terminator.lua @@ -0,0 +1,18 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [=[ +[[${_style_name}]] + palette = "${term.black}:${term.red}:${term.green}:${term.yellow}:${term.blue}:${term.purple}:${term.cyan}:${term.white}:${term.bright_black}:${term.bright_red}:${term.bright_green}:${term.bright_yellow}:${term.bright_blue}:${term.bright_purple}:${term.bright_cyan}:${term.bright_white}" + background_color = "${ui.base}" + foreground_color = "${syntax.text}" +]=], + colors + ) +end + +return M From 2840d1e5820c2d4aebfafa498262618cf7779a58 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:12:15 -0400 Subject: [PATCH 14/19] feat(extras): add Tilix theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/tilix.lua | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lua/astrotheme/extras/tilix.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 1e78ea2..c8293c5 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -26,6 +26,7 @@ M.extras = { slack = {ext = "txt", url = "https://slack.com", label = "Slack"}, spotify_player = {ext = "toml", url = "https://github.com/aome510/spotify-player", label = "Spotify Player"}, terminator = { ext = "conf", url = "https://gnome-terminator.readthedocs.io/en/latest/config.html", label = "Terminator" }, + tilix = { ext = "json", url = "https://github.com/gnunn1/tilix", label = "Tilix" }, } function M.setup() diff --git a/lua/astrotheme/extras/tilix.lua b/lua/astrotheme/extras/tilix.lua new file mode 100644 index 0000000..33bbb50 --- /dev/null +++ b/lua/astrotheme/extras/tilix.lua @@ -0,0 +1,39 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +{ + "name": "${_style_name}", + "comment": "", + "use-theme-colors": false, + "foreground-color": "${syntax.text}", + "background-color": "${ui.base}", + "palette": [ + "${term.black}", + "${term.red}", + "${term.green}", + "${term.yellow}", + "${term.blue}", + "${term.purple}", + "${term.cyan}", + "${term.white}", + "${term.bright_black}", + "${term.bright_red}", + "${term.bright_green}", + "${term.bright_yellow}", + "${term.bright_blue}", + "${term.bright_purple}", + "${term.bright_cyan}", + "${term.bright_white}" + ] +} +]], + colors + ) +end + +return M From a13c265ae750b30fca2b3f34afa354cebaad8567 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:12:31 -0400 Subject: [PATCH 15/19] feat(extras): add Windows Terminal theme --- lua/astrotheme/extras/init.lua | 5 +-- lua/astrotheme/extras/windows_terminal.lua | 39 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 lua/astrotheme/extras/windows_terminal.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index c8293c5..3916016 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -9,8 +9,6 @@ local M = {} -- stylua: ignore M.extras = { -- Keep all entries here aligned by the first `=` sign - vim = { ext = "vim", url = "https://vimhelp.org/", label = "Vim", subdir = "colors"}, - wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, alacritty = { ext = "toml", url = "https://github.com/alacritty/alacritty", label = "Alacritty" }, delta = { ext = "gitconfig", url = "https://github.com/dandavison/delta", label = "Delta" }, dunst = { ext = "dunstrc", url = "https://dunst-project.org/", label = "Dunst" }, @@ -27,6 +25,9 @@ M.extras = { spotify_player = {ext = "toml", url = "https://github.com/aome510/spotify-player", label = "Spotify Player"}, terminator = { ext = "conf", url = "https://gnome-terminator.readthedocs.io/en/latest/config.html", label = "Terminator" }, tilix = { ext = "json", url = "https://github.com/gnunn1/tilix", label = "Tilix" }, + vim = { ext = "vim", url = "https://vimhelp.org/", label = "Vim", subdir = "colors"}, + wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, + windows_terminal = { ext = "json", url = "https://aka.ms/terminal-documentation", label = "Windows Terminal" }, } function M.setup() diff --git a/lua/astrotheme/extras/windows_terminal.lua b/lua/astrotheme/extras/windows_terminal.lua new file mode 100644 index 0000000..76465de --- /dev/null +++ b/lua/astrotheme/extras/windows_terminal.lua @@ -0,0 +1,39 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +# Add the following object to your Windows Terminal configuration +# https://learn.microsoft.com/en-us/windows/terminal/customize-settings/color-schemes#creating-your-own-color-scheme +{ + "background": "${ui.base}", + "black": "${term.black}", + "blue": "${term.blue}", + "brightBlack": "${term.bright_black}", + "brightBlue": "${term.bright_blue}", + "brightCyan": "${term.bright_cyan}", + "brightGreen": "${term.bright_green}", + "brightPurple": "${term.bright_purple}", + "brightRed": "${term.bright_red}", + "brightWhite": "${term.bright_white}", + "brightYellow": "${term.bright_yellow}", + "cursorColor": "${syntax.text}", + "cyan": "${term.cyan}", + "foreground": "${syntax.text}", + "green": "${term.green}", + "name": "${_style_name}", + "purple": "${term.purple}", + "red": "${term.red}", + "selectionBackground": "${ui.selection}", + "white": "${term.white}", + "yellow": "${term.yellow}" +} +]], + colors + ) +end + +return M From f6ecafe8af19f83f397a9be80112470e8c81927c Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:12:45 -0400 Subject: [PATCH 16/19] feat(extras): add XFCE Terminal theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/xfceterm.lua | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 lua/astrotheme/extras/xfceterm.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 3916016..27468e1 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -28,6 +28,7 @@ M.extras = { vim = { ext = "vim", url = "https://vimhelp.org/", label = "Vim", subdir = "colors"}, wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, windows_terminal = { ext = "json", url = "https://aka.ms/terminal-documentation", label = "Windows Terminal" }, + xfceterm = { ext = "theme", url = "https://docs.xfce.org/apps/terminal/advanced", label = "Xfce Terminal" }, } function M.setup() diff --git a/lua/astrotheme/extras/xfceterm.lua b/lua/astrotheme/extras/xfceterm.lua new file mode 100644 index 0000000..9230358 --- /dev/null +++ b/lua/astrotheme/extras/xfceterm.lua @@ -0,0 +1,23 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +[Scheme] +Name="${_style_name}" +ColorBackground=${ui.base} +ColorForeground=${syntax.text} + +ColorSelectionBackground=${ui.selection} +ColorSelection=${syntax.text} + +ColorPalette=${term.black};${term.red};${term.green};${term.yellow};${term.blue};${term.purple};${term.cyan};${term.white};${term.bright_black};${term.bright_red};${term.bright_green};${term.bright_yellow};${term.bright_blue};${term.bright_purple};${term.bright_cyan};${term.bright_white} +]], + colors + ) +end + +return M From 8d12833e4da85edbe2156851b8a075f2cd7583f1 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:12:57 -0400 Subject: [PATCH 17/19] feat(extras): add XResources theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/xresources.lua | 36 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 lua/astrotheme/extras/xresources.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 27468e1..4662045 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -29,6 +29,7 @@ M.extras = { wezterm = { ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm" }, windows_terminal = { ext = "json", url = "https://aka.ms/terminal-documentation", label = "Windows Terminal" }, xfceterm = { ext = "theme", url = "https://docs.xfce.org/apps/terminal/advanced", label = "Xfce Terminal" }, + xresources = { ext = "Xresources", url = "https://wiki.archlinux.org/title/X_resources", label = "Xresources" }, } function M.setup() diff --git a/lua/astrotheme/extras/xresources.lua b/lua/astrotheme/extras/xresources.lua new file mode 100644 index 0000000..da3053c --- /dev/null +++ b/lua/astrotheme/extras/xresources.lua @@ -0,0 +1,36 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +! ${_style_name} colors for Xresources + +*background: ${ui.base} +*foreground: ${syntax.text} + +*color0: ${term.black} +*color1: ${term.red} +*color2: ${term.green} +*color3: ${term.yellow} +*color4: ${term.blue} +*color5: ${term.purple} +*color6: ${term.cyan} +*color7: ${term.white} + +*color8: ${term.bright_black} +*color9: ${term.bright_red} +*color10: ${term.bright_green} +*color11: ${term.bright_yellow} +*color12: ${term.bright_blue} +*color13: ${term.bright_purple} +*color14: ${term.bright_cyan} +*color15: ${term.bright_white} +]], + colors + ) +end + +return M From a3b0c67e36004f1830dc376113938a910da178e2 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:13:25 -0400 Subject: [PATCH 18/19] feat(extras): add zellij theme --- lua/astrotheme/extras/init.lua | 1 + lua/astrotheme/extras/zellij.lua | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 lua/astrotheme/extras/zellij.lua diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 4662045..40f323c 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -30,6 +30,7 @@ M.extras = { windows_terminal = { ext = "json", url = "https://aka.ms/terminal-documentation", label = "Windows Terminal" }, xfceterm = { ext = "theme", url = "https://docs.xfce.org/apps/terminal/advanced", label = "Xfce Terminal" }, xresources = { ext = "Xresources", url = "https://wiki.archlinux.org/title/X_resources", label = "Xresources" }, + zellij = { ext = "kdl", url = "https://zellij.dev/", label = "Zellij" }, } function M.setup() diff --git a/lua/astrotheme/extras/zellij.lua b/lua/astrotheme/extras/zellij.lua new file mode 100644 index 0000000..f415949 --- /dev/null +++ b/lua/astrotheme/extras/zellij.lua @@ -0,0 +1,33 @@ +local util = require "astrotheme.extras" + +local M = {} + +--- @param colors AstroThemePalette +function M.generate(colors) + return util.template( + [[ +// ${_style_name} Zellij Colors +// Add this file to your `CONFIG_DIR/themes` directory as described here: +// https://zellij.dev/documentation/themes#getting-zellij-to-pick-up-the-theme + +themes { + ${_style_name} { + fg "${syntax.text}" + bg "${ui.base}" + black "${term.black}" + red "${term.red}" + green "${term.green}" + yellow "${term.yellow}" + blue "${term.blue}" + magenta "${term.purple}" + cyan "${term.cyan}" + white "${term.white}" + orange "${syntax.orange}" + } +} +]], + colors + ) +end + +return M From b6332e1caba046dc1410df390536c6010c102ef6 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 12 Jul 2024 15:13:37 -0400 Subject: [PATCH 19/19] fix(extras): improve palette style names --- lua/astrotheme/extras/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/astrotheme/extras/init.lua b/lua/astrotheme/extras/init.lua index 40f323c..b0addd0 100644 --- a/lua/astrotheme/extras/init.lua +++ b/lua/astrotheme/extras/init.lua @@ -38,10 +38,10 @@ function M.setup() -- map of style to style name local palettes = { - astrodark = "Dark", - astrolight = "Light", - astromars = "Mars", - astrojupiter = "Jupiter", + astrodark = "AstroDark", + astrolight = "AstroLight", + astromars = "AstroMars", + astrojupiter = "AstroJupiter", } ---@type string[] @@ -58,7 +58,7 @@ function M.setup() local highlights = util.get_highlights(colors, config) local fname = extra .. (info.subdir and "/" .. info.subdir or "") .. "/" .. palette .. "." .. info.ext colors["_upstream_url"] = "https://github.com/AstroNvim/astrotheme/raw/main/extras/" .. fname - colors["_style_name"] = "AstroTheme " .. palette_name + colors["_style_name"] = palette_name colors["_style"] = palette print("[write] " .. fname) M.write("extras/" .. fname, plugin.generate(colors, highlights, config))