Skip to content

Commit 7a8e826

Browse files
committed
feat(extras): add Gnome Terminal theme
1 parent e72a6b8 commit 7a8e826

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
local util = require "astrotheme.extras"
2+
3+
local M = {}
4+
5+
--- @param colors AstroThemePalette
6+
function M.generate(colors)
7+
local function normalize_colors(_colors)
8+
local new_colors = {}
9+
for k, v in pairs(_colors) do
10+
local new_color = v
11+
if type(v) == "string" and v:match "^#" then
12+
local hex = v:gsub("^#", "")
13+
new_color = string.format(
14+
"rgb(%d, %d, %d)",
15+
tonumber(hex:sub(1, 2), 16),
16+
tonumber(hex:sub(3, 4), 16),
17+
tonumber(hex:sub(5, 6), 16)
18+
)
19+
elseif type(v) == "table" then
20+
new_color = normalize_colors(v)
21+
end
22+
new_colors[k] = new_color
23+
end
24+
return new_colors
25+
end
26+
return util.template(
27+
[[
28+
# Import this theme as follows:
29+
# 1. Create a new profile for GNOME Terminal
30+
# 2. Copy the UUID of the new profile (bottom right corner of the preferences window)
31+
# 3. Replace <PROFILE_UUID> below with the copied UUID
32+
# 4. Execute `dconf load /org/gnome/terminal/legacy/profiles:/ < ${_style}.dconf`
33+
[:<PROFILE_UUID>]
34+
background-color='${ui.base}'
35+
cursor-background-color='${ui.text}'
36+
cursor-colors-set=true
37+
cursor-foreground-color='${ui.base}'
38+
foreground-color='${syntax.text}'
39+
highlight-background-color='${ui.selection}'
40+
highlight-colors-set=true
41+
highlight-foreground-color='${syntax.text}'
42+
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}']
43+
use-theme-colors=false
44+
visible-name='${_style_name}'
45+
]],
46+
normalize_colors(colors)
47+
)
48+
end
49+
50+
return M

lua/astrotheme/extras/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ M.extras = {
1818
fuzzel = { ext = "ini", url = "https://codeberg.org/dnkl/fuzzel", label = "Fuzzel" },
1919
fzf = { ext = "sh", url = "https://github.com/junegunn/fzf", label = "Fzf" },
2020
ghostty = { ext = "config", url = "https://github.com/ghostty-org", label = "Ghostty" },
21+
gnome_terminal = { ext = "dconf", url = "https://gitlab.gnome.org/GNOME/gnome-terminal", label = "GNOME Terminal"},
2122
gitui = { ext = "ron", url = "https://github.com/extrawurst/gitui", label = "GitUI" },
2223
helix = { ext = "toml", url = "https://helix-editor.com/", label = "Helix" },
2324
iterm = { ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm" },

0 commit comments

Comments
 (0)