Skip to content

Commit

Permalink
Merge pull request #13 from savq/dev
Browse files Browse the repository at this point in the history
Add wezterm and other minor changes
  • Loading branch information
savq authored May 28, 2021
2 parents d974dc1 + 1961c03 commit 49a0d96
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 120 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Alacritty](https://github.com/alacritty/alacritty)
- [iTerm2](https://github.com/gnachman/iTerm2)
- [Kitty](https://github.com/kovidgoyal/kitty)
- [Wezterm](https://github.com/wez/wezterm)


## Requirements
Expand Down
1 change: 1 addition & 0 deletions colors/melange.vim
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,4 @@ highlight! link TabLineSel StatusLine
highlight! link Typedef Type
highlight! link WildMenu Pmenu
endif

153 changes: 89 additions & 64 deletions lua/melange/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,102 @@ vim.cmd('packadd lush.nvim')
local uv = vim.loop
local lush = require('lush')

-- format each entry in a table, and concatenate them into a single string
local function concat_format(t)
return table.concat(vim.tbl_map(function(x) return string.format(unpack(x)) end, t), "\n")
end

-- write the contents of a buffer to a file
local function write_file(file, buf)
local fd = assert(uv.fs_open(file, 'w', 420))
uv.fs_write(fd, buf, -1)
uv.fs_write(fd, '\n', -1)
assert(uv.fs_close(fd))
end

local targets = {}

function targets.alacritty(colorscheme)
local c = colorscheme.Melange.lush
return table.concat({
" primary:",
" foreground: '" .. c.fg .. "'",
" background: '" .. c.bg .. "'",
" normal:",
" white: '" .. c.fg .. "'",
" black: '" .. c.mid .. "'",
" red: '" .. c.red .. "'",
" yellow: '" .. c.yellow .. "'",
" green: '" .. c.teal .. "'",
" cyan: '" .. c.cyan .. "'",
" blue: '" .. c.blue .. "'",
" magenta: '" .. c.purple .. "'",
" bright:",
" white: '" .. c.fg .. "'",
" black: '" .. c.drop .. "'",
" red: '" .. c.salmon .. "'",
" yellow: '" .. c.orange .. "'",
" green: '" .. c.green .. "'",
" cyan: '" .. c.cyan .. "'",
" blue: '" .. c.blue .. "'",
" magenta: '" .. c.magenta .. "'",
}, "\n")
return concat_format {
{"colors:"};
{" primary:"};
{" foreground: '%s'", c.fg};
{" background: '%s'", c.bg};
{" normal:"};
{" white: '%s'", c.fg};
{" black: '%s'", c.mid};
{" red: '%s'", c.red};
{" yellow: '%s'", c.yellow};
{" green: '%s'", c.teal};
{" cyan: '%s'", c.cyan};
{" blue: '%s'", c.blue};
{" magenta: '%s'", c.purple};
{" bright:"};
{" white: '%s'", c.fg};
{" black: '%s'", c.drop};
{" red: '%s'", c.salmon};
{" yellow: '%s'", c.orange};
{" green: '%s'", c.green};
{" cyan: '%s'", c.cyan};
{" blue: '%s'", c.blue};
{" magenta: '%s'", c.magenta};
}
end

function targets.kitty(colorscheme)
local c = colorscheme.Melange.lush
return table.concat({
"background " .. c.bg,
"foreground " .. c.fg,
"cursor " .. c.fg,
"url_color " .. colorscheme.TSURI.fg,

"selection_background " .. colorscheme.Visual.bg,
"selection_foreground " .. c.fg,

"tab_bar_background " .. colorscheme.TabLineFill.bg,
"active_tab_background " .. colorscheme.TabLineSel.bg,
"active_tab_foreground " .. c.fg,
"inactive_tab_background " .. colorscheme.TabLine.bg,
"inactive_tab_foreground " .. c.fg,
return concat_format {
{"background %s", c.bg};
{"foreground %s", c.fg};
{"cursor %s", c.fg};
{"url_color %s", colorscheme.TSURI.fg};

{"selection_background %s", colorscheme.Visual.bg};
{"selection_foreground %s", c.fg};
{"tab_bar_background %s", colorscheme.TabLineFill.bg};
{"active_tab_background %s", colorscheme.TabLineSel.bg};
{"active_tab_foreground %s", c.fg};
{"inactive_tab_background %s", colorscheme.TabLine.bg};
{"inactive_tab_foreground %s", c.fg};

-- normal
"color0 " .. c.bg,
"color1 " .. c.red,
"color2 " .. c.teal,
"color3 " .. c.yellow,
"color4 " .. c.blue,
"color5 " .. c.purple,
"color6 " .. c.cyan,
"color7 " .. c.fg,
{"color0 %s", c.bg};
{"color1 %s", c.red};
{"color2 %s", c.teal};
{"color3 %s", c.yellow};
{"color4 %s", c.blue};
{"color5 %s", c.purple};
{"color6 %s", c.cyan};
{"color7 %s", c.fg};
-- bright
"color8 " .. c.overbg,
"color9 " .. c.salmon,
"color10 " .. c.green,
"color11 " .. c.orange,
"color12 " .. c.blue,
"color13 " .. c.purple,
"color14 " .. c.cyan,
"color15 " .. c.fg,
""
}, "\n")
{"color8 %s", c.overbg};
{"color9 %s", c.salmon};
{"color10 %s", c.green};
{"color11 %s", c.orange};
{"color12 %s", c.blue};
{"color13 %s", c.purple};
{"color14 %s", c.cyan};
{"color15 %s", c.fg};
}
end

function targets.wezterm(colorscheme)
local c = colorscheme.Melange.lush
return concat_format {
{'[colors]'};
{'foreground = "%s"', c.fg};
{'background = "%s"', c.bg};
{'cursor_bg = "%s"', c.fg};
{'cursor_border = "%s"', c.fg};
{'cursor_fg = "%s"', c.bg};
{'selection_bg = "%s"', c.fg};
{'selection_fg = "%s"', c.bg};
{'ansi = ["%s","%s","%s","%s","%s","%s","%s","%s"]',
c.bg, c.red, c.teal, c.yellow, c.blue, c.purple, c.cyan, c.drop};
{'brights = ["%s","%s","%s","%s","%s","%s","%s","%s"]',
c.overbg, c.salmon, c.green, c.orange, c.blue, c.magenta, c.cyan, c.fg};
}
end

local viml_template = [[
Expand All @@ -97,12 +127,6 @@ function targets.viml(colorscheme)
return table.concat(vim.fn.sort(compiled), '\n') --Sort items for better diffs
end

local function write_file(file, buf)
local fd = assert(uv.fs_open(file, 'w', 420))
uv.fs_write(fd, buf, -1)
assert(uv.fs_close(fd))
end

local function buildall()
local melange; --module
local colorscheme; --lush colorscheme
Expand All @@ -113,9 +137,9 @@ local function buildall()
vim.o.background = l
melange = require('melange')

write_file(string.format("./term/alacritty_%s.yml", l), targets.alacritty(melange))

write_file(string.format("./term/kitty_%s.conf", l), targets.kitty(melange))
for t,f in pairs{alacritty='yml', kitty='conf', wezterm='toml'} do
write_file(string.format("./term/%s/melange_%s.%s", t, l, f), targets[t](melange))
end

vimcolors[l] = targets.viml(melange)
end
Expand All @@ -128,3 +152,4 @@ end
return {
buildall = buildall,
}

3 changes: 2 additions & 1 deletion term/alacritty_dark.yml → term/alacritty/melange_dark.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
colors:
primary:
foreground: '#EBE6E0'
background: '#2A2622'
Expand All @@ -18,4 +19,4 @@
green: '#8BC270'
cyan: '#85ADAD'
blue: '#9CA7C9'
magenta: '#D194C7'
magenta: '#D194C7'
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
colors:
primary:
foreground: '#5C4D3D'
background: '#E8D9C9'
Expand All @@ -18,4 +19,4 @@
green: '#6AAB49'
cyan: '#629393'
blue: '#6D7EB0'
magenta: '#BC62AD'
magenta: '#BC62AD'
27 changes: 27 additions & 0 deletions term/kitty/melange_dark.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
background #2A2622
foreground #EBE6E0
cursor #EBE6E0
url_color #D194C7
selection_background #38332E
selection_foreground #EBE6E0
tab_bar_background #38332E
active_tab_background #38332E
active_tab_foreground #EBE6E0
inactive_tab_background #38332E
inactive_tab_foreground #EBE6E0
color0 #2A2622
color1 #D65C70
color2 #4DB380
color3 #F7C96E
color4 #9CA7C9
color5 #997AB8
color6 #85ADAD
color7 #EBE6E0
color8 #38332E
color9 #F7856E
color10 #8BC270
color11 #CC8033
color12 #9CA7C9
color13 #997AB8
color14 #85ADAD
color15 #EBE6E0
27 changes: 27 additions & 0 deletions term/kitty/melange_light.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
background #E8D9C9
foreground #5C4D3D
cursor #5C4D3D
url_color #BC62AD
selection_background #E0CCB8
selection_foreground #5C4D3D
tab_bar_background #E0CCB8
active_tab_background #E0CCB8
active_tab_foreground #5C4D3D
inactive_tab_background #E0CCB8
inactive_tab_foreground #5C4D3D
color0 #E8D9C9
color1 #C43149
color2 #3D8F66
color3 #D79B23
color4 #6D7EB0
color5 #7A569F
color6 #629393
color7 #5C4D3D
color8 #E0CCB8
color9 #E0593E
color10 #6AAB49
color11 #CA731C
color12 #6D7EB0
color13 #7A569F
color14 #629393
color15 #5C4D3D
27 changes: 0 additions & 27 deletions term/kitty_dark.conf

This file was deleted.

27 changes: 0 additions & 27 deletions term/kitty_light.conf

This file was deleted.

10 changes: 10 additions & 0 deletions term/wezterm/melange_dark.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[colors]
foreground = "#EBE6E0"
background = "#2A2622"
cursor_bg = "#EBE6E0"
cursor_border = "#EBE6E0"
cursor_fg = "#2A2622"
selection_bg = "#EBE6E0"
selection_fg = "#2A2622"
ansi = ["#2A2622","#D65C70","#4DB380","#F7C96E","#9CA7C9","#997AB8","#85ADAD","#A38C75"]
brights = ["#38332E","#F7856E","#8BC270","#CC8033","#9CA7C9","#D194C7","#85ADAD","#EBE6E0"]
10 changes: 10 additions & 0 deletions term/wezterm/melange_light.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[colors]
foreground = "#5C4D3D"
background = "#E8D9C9"
cursor_bg = "#5C4D3D"
cursor_border = "#5C4D3D"
cursor_fg = "#E8D9C9"
selection_bg = "#5C4D3D"
selection_fg = "#E8D9C9"
ansi = ["#E8D9C9","#C43149","#3D8F66","#D79B23","#6D7EB0","#7A569F","#629393","#8A735C"]
brights = ["#E0CCB8","#E0593E","#6AAB49","#CA731C","#6D7EB0","#BC62AD","#629393","#5C4D3D"]

0 comments on commit 49a0d96

Please sign in to comment.