First stab at converting to farout palette

Also renamed all/most instances of tokyonight to farout
This commit is contained in:
2023-12-01 15:30:50 -05:00
parent f247ee700b
commit 1752319cc5
130 changed files with 18963 additions and 301 deletions

View File

@@ -1,4 +1,4 @@
local c = require("tokyonight.colors").setup({ transform = true })
local c = require("farout.colors").setup({ transform = true })
local M = {
normal = { bg = c.none, fg = c.fg_dark },

View File

@@ -1,44 +1,45 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
---@class Palette
M.default = {
none = "NONE",
bg_dark = "#1f2335",
bg = "#24283b",
bg_highlight = "#292e42",
terminal_black = "#414868",
fg = "#c0caf5",
fg_dark = "#a9b1d6",
fg_gutter = "#3b4261",
dark3 = "#545c7e",
comment = "#565f89",
dark5 = "#737aa2",
blue0 = "#3d59a1",
blue = "#7aa2f7",
cyan = "#7dcfff",
blue1 = "#2ac3de",
blue2 = "#0db9d7",
blue5 = "#89ddff",
blue6 = "#b4f9f8",
blue7 = "#394b70",
magenta = "#bb9af7",
magenta2 = "#ff007c",
purple = "#9d7cd8",
bg_dark = "#1f1311",
bg = "#0f0908",
bg_highlight = "#241816",
terminal_black = "#392D2B",
fg = "#E0CCAE",
fg_dark = "#F2A766",
fg_gutter = "#6B4035",
dark3 = "#66292F",
comment = "#6B4035",
dark5 = "#A67458",
blue0 = "#f49d69",
blue = "#d47d49",
cyan = "#a67458",
-- TODO: rename to orange/red
blue1 = "#BF472C",
blue2 = "#A4895C",
blue5 = "#a67458",
blue6 = "#BC907B",
blue7 = "#703F29",
magenta = "#8a4b53",
magenta2 = "#aa6b73",
purple = "#a47a7a",
orange = "#ff9e64",
yellow = "#e0af68",
green = "#9ece6a",
green1 = "#73daca",
green2 = "#41a6b5",
teal = "#1abc9c",
red = "#f7768e",
red1 = "#db4b4b",
git = { change = "#6183bb", add = "#449dab", delete = "#914c54" },
yellow = "#f2a766",
green = "#a4896f",
green1 = "#c4a98f",
green2 = "#ceb399",
teal = "#c69478",
red = "#bf472c",
red1 = "#df674c",
git = { change = "#66292F", add = "#A4895C", delete = "#BF472C" },
gitSigns = {
add = "#266d6a",
change = "#536c9e",
delete = "#b2555b",
add = "#CAAF82",
change = "#8C4F55",
delete = "#E26F55",
},
}
@@ -98,7 +99,7 @@ end
---@return ColorScheme
function M.setup(opts)
opts = opts or {}
local config = require("tokyonight.config")
local config = require("farout.config")
local style = config.is_day() and config.options.light_style or config.options.style
local palette = M[style] or {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
@@ -13,7 +13,7 @@ function M.generate(colors)
local alacritty = util.template(
[[
# TokyoNight Alacritty Colors
# FarOut Alacritty Colors
colors:
# Default colors
primary:

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local function hex2rgb(key, value)
local hex = value:gsub("#", "")

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
@@ -13,8 +13,8 @@ function M.generate(colors)
builtin = "@type.builtin",
enum = {
"@lsp.type.enum",
variant = "@lsp.type.enumMember"
}
variant = "@lsp.type.enumMember",
},
},
-- rust: pattern matching `let Some(_) = ...`
-- ^^^^
@@ -23,17 +23,17 @@ function M.generate(colors)
"Constant",
builtin = {
"@constant.builtin",
boolean = "Boolean"
boolean = "Boolean",
},
character = {
"Character",
escape = "@string.escape"
escape = "@string.escape",
},
numeric = {
"Number",
float = "Float",
integer = "Number"
}
integer = "Number",
},
},
string = {
"String",
@@ -42,8 +42,8 @@ function M.generate(colors)
"@string.special",
path = nil,
url = nil,
symbol = nil
}
symbol = nil,
},
},
comment = {
"@comment",
@@ -51,8 +51,8 @@ function M.generate(colors)
block = {
nil,
-- not sure about that one
documentation = "@string.documentation"
}
documentation = "@string.documentation",
},
},
variable = {
"@variable",
@@ -60,8 +60,8 @@ function M.generate(colors)
parameter = "@parameter",
other = {
nil,
member = "@field"
}
member = "@field",
},
},
label = "@label",
keyword = {
@@ -72,16 +72,16 @@ function M.generate(colors)
["repeat"] = "Repeat",
import = nil,
["return"] = "@keyword.return",
exception = "Exception"
exception = "Exception",
},
operator = "Statement",
directive = "PreProc",
["function"] = "@keyword.function",
storage = {
nil, -- rust: `let`
type = nil, -- rust: `struct` & `type`
modifier = nil -- rust: `mut`
}
nil, -- rust: `let`
type = nil, -- rust: `struct` & `type`
modifier = nil, -- rust: `mut`
},
},
operator = "Operator",
["function"] = {
@@ -90,12 +90,12 @@ function M.generate(colors)
method = "@method",
macro = "@function.macro",
-- Defined as "preprocessor in C", so using "PreProc", not sure though
special = "PreProc"
special = "PreProc",
},
tag = {
"@tag",
-- ???
builtin = nil
builtin = nil,
},
namespace = "@namespace",
special = "Special",
@@ -113,26 +113,26 @@ function M.generate(colors)
h6 = nil,
-- UI --
completion = "Pmenu",
hover = "PmenuSel"
hover = "PmenuSel",
},
list = {
"markdownHeadingDelimiter",
unnumbered = nil,
numbered = nil,
checked = nil,
unchecked = nil
unchecked = nil,
},
bold = "Bold",
italic = "Italic",
strikethrough = {
'helix',
modifiers = { 'crossed_out' }
"helix",
modifiers = { "crossed_out" },
},
link = {
"markdownLinkText",
url = "Underlined",
label = "markdownCode",
text = "markdownCode"
text = "markdownCode",
},
quote = nil,
raw = {
@@ -141,13 +141,13 @@ function M.generate(colors)
block = "markdownCodeBlock",
-- UI --
completion = nil,
hover = nil
hover = nil,
},
-- UI --
normal = {
nil,
completion = "CmpItemMenu",
hover = "CmpItemKindDefault"
hover = "CmpItemKindDefault",
},
},
diff = {
@@ -156,13 +156,13 @@ function M.generate(colors)
minus = "diffRemoved",
delta = {
"diffChanged",
moved = "diffFile"
}
moved = "diffFile",
},
},
ui = {
background = {
{ "helix", bg = "bg" },
separator = nil
separator = nil,
},
cursor = {
"Cursor",
@@ -179,15 +179,15 @@ function M.generate(colors)
},
debug = {
breakpoint = nil,
active = nil
active = nil,
},
gutter = {
nil,
selected = nil
selected = nil,
},
highlight = {
nil,
frameline = nil
frameline = nil,
},
linenr = {
"LineNr",
@@ -198,17 +198,17 @@ function M.generate(colors)
inactive = "StatusLineNc",
-- Inspired from lualine
normal = {
'helix',
"helix",
bg = "blue",
fg = "black"
fg = "black",
},
insert = nil,
select = nil,
separator = nil
separator = nil,
},
popup = {
"TelescopeBorder",
info = nil
info = nil,
},
window = "WinSeparator",
help = nil,
@@ -228,28 +228,28 @@ function M.generate(colors)
parameter = nil,
type = nil,
},
wrap = nil
wrap = nil,
},
menu = {
"Pmenu",
selected = "PmenuSel",
scroll = {
'helix',
"helix",
fg = vim.api.nvim_get_hl(0, { name = "PmenuThumb" }).bg,
bg = vim.api.nvim_get_hl(0, { name = "PmenuSbar" }).bg,
}
},
},
selection = {
{ 'helix', bg = "bg_highlight" },
primary = nil
{ "helix", bg = "bg_highlight" },
primary = nil,
},
cursorline = {
primary = nil,
secondary = nil
secondary = nil,
},
cursorcolumn = {
primary = nil,
secondary = nil
secondary = nil,
},
},
hint = "DiagnosticHint",
@@ -261,15 +261,15 @@ function M.generate(colors)
hint = "DiagnosticUnderlineHint",
info = "DiagnosticUnderlineInfo",
warning = "DiagnosticUnderlineWarn",
error = "DiagnosticUnderlineError"
}
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
if hx_scope:match("%.") then
hx_scope = '"' .. hx_scope .. '"'
end
@@ -277,8 +277,8 @@ function M.generate(colors)
goto continue
end
if type(group) == "table" and group[1] == 'helix' then
table.remove(group, 1);
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)))
goto continue
end
@@ -296,16 +296,16 @@ function M.generate(colors)
::continue::
end
table.insert(config, '\n[palette]');
table.insert(config, "\n[palette]")
for name, color in M.pairsByKeys(M.flatten(colors)) do
if name:match('%.') then
if name:match("%.") then
name = '"' .. name .. '"'
end
if type(color) == 'string' and not string.starts(name, '_') and name ~= 'none' then
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')
return table.concat(config, "\n")
end
function string.starts(String, Start)
@@ -315,15 +315,15 @@ end
function M.flatten(t)
local res = {}
for k, v in pairs(t) do
if type(v) == 'table' then
if v[1] ~= 'helix' then
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
res[k .. "." .. k2] = v2
end
end
else
@@ -339,9 +339,11 @@ 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
for n in pairs(t) do
table.insert(a, n)
end
table.sort(a, f)
local i = 0 -- iterator variable
local i = 0 -- iterator variable
local iter = function() -- iterator function
i = i + 1
if a[i] == nil then
@@ -369,13 +371,13 @@ function M.to_helix_config(highlight)
end
if mods.underline then
style.underline = {
style = "line"
style = "line",
}
end
if mods.undercurl and highlight.sp then
style.underline = {
color = M.to_rgb(mods.sp),
style = "curl"
style = "curl",
}
end
end
@@ -405,7 +407,7 @@ end
function M.to_toml(style)
local buffer = {}
M.insert_as_toml(buffer, style)
return table.concat(buffer, '')
return table.concat(buffer, "")
end
function M.insert_as_toml(buffer, x)
@@ -416,7 +418,7 @@ function M.insert_as_toml(buffer, x)
if M.is_array(x) then
table.insert(buffer, "[")
for _, v in pairs(x) do
M.insert_as_toml(buffer, v);
M.insert_as_toml(buffer, v)
table.insert(buffer, ", ")
end
table.remove(buffer)
@@ -424,8 +426,8 @@ function M.insert_as_toml(buffer, x)
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, string.format("%s = ", k))
M.insert_as_toml(buffer, v)
table.insert(buffer, ", ")
end
table.remove(buffer)
@@ -442,7 +444,9 @@ function M.is_array(t)
local i = 0
for _ in pairs(t) do
i = i + 1
if t[i] == nil then return false end
if t[i] == nil then
return false
end
end
return true
end

View File

@@ -67,7 +67,7 @@ end
function M.setup()
M.docs()
local tokyonight = require("tokyonight")
local farout = require("farout")
vim.o.background = "dark"
-- map of style to style name
@@ -79,17 +79,17 @@ function M.setup()
}
for extra, info in pairs(M.extras) do
package.loaded["tokyonight.extra." .. extra] = nil
local plugin = require("tokyonight.extra." .. extra)
package.loaded["farout.extra." .. extra] = nil
local plugin = require("farout.extra." .. extra)
for style, style_name in pairs(styles) do
tokyonight.setup({ style = style })
tokyonight.load({ style = style })
vim.cmd.colorscheme("tokyonight-" .. style)
local colors = require("tokyonight.colors").setup({ transform = true })
local fname = extra .. "/tokyonight_" .. style .. "." .. info.ext
colors["_upstream_url"] = "https://github.com/folke/tokyonight.nvim/raw/main/extras/" .. fname
colors["_style_name"] = "Tokyo Night" .. style_name
colors["_name"] = "tokyonight_" .. style
farout.setup({ style = style })
farout.load({ style = style })
vim.cmd.colorscheme("farout-" .. style)
local colors = require("farout.colors").setup({ transform = true })
local fname = extra .. "/farout" .. style .. "." .. info.ext
colors["_upstream_url"] = "https://github.com/thallada/farout.nvim/raw/main/extras/" .. fname
colors["_style_name"] = "FarOut" .. style_name
colors["_name"] = "farout" .. style
write(plugin.generate(colors), fname)
end
end

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -20,7 +20,7 @@ function M.generate(colors)
local ret = "local colors = "
.. vim.inspect(colors)
.. "\n\nlocal highlights = "
.. vim.inspect(deepcopy(require("tokyonight.theme").setup().highlights))
.. vim.inspect(deepcopy(require("farout.theme").setup().highlights))
.. "\n"
return ret
end

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
@@ -9,9 +9,9 @@ function M.generate(colors)
end
-- vim.schedule(function()
-- local config = require("tokyonight.config")
-- local config = require("farout.config")
-- config.setup({ style = "storm" })
-- local colors = require("tokyonight.colors").setup()
-- local colors = require("farout.colors").setup()
--
-- local lookup = {}
--
@@ -40,11 +40,11 @@ M.template = [[
<plist version="1.0">
<dict>
<key>author</key>
<string>Folke Lemaitre (http://github.com/folke)</string>
<string>Tyler Hallada (http://github.com/thallada)</string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>name</key>
<string>TokyoNight</string>
<string>FarOut</string>
<key>semanticClass</key>
<string>enki.theme.tokyo</string>
<key>settings</key>

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
@@ -8,7 +8,7 @@ function M.generate(colors)
[[
#!/usr/bin/env bash
# TokyoNight colors for Tmux
# FarOut colors for Tmux
set -g mode-style "fg=${blue},bg=${fg_gutter}"

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,10 +1,11 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
--- @param colors ColorScheme
function M.generate(colors)
local windows_terminal = util.template([[
local windows_terminal = 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
{

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
@@ -7,7 +7,7 @@ function M.generate(colors)
local xfceterm = util.template(
[[
[Scheme]
Name=TokyoNight Colors
Name=FarOut Colors
ColorBackground=${bg}
ColorForeground=${fg}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}
@@ -6,7 +6,7 @@ local M = {}
function M.generate(colors)
local xr = util.template(
[[
! TokyoNight colors for Xresources
! FarOut colors for Xresources
*background: ${bg}
*foreground: ${fg}

View File

@@ -1,4 +1,4 @@
local util = require("tokyonight.util")
local util = require("farout.util")
local M = {}

View File

@@ -1,15 +1,15 @@
local util = require("tokyonight.util")
local theme = require("tokyonight.theme")
local config = require("tokyonight.config")
local util = require("farout.util")
local theme = require("farout.theme")
local config = require("farout.config")
local M = {}
function M._load(style)
if style and not M._style then
M._style = require("tokyonight.config").options.style
M._style = require("farout.config").options.style
end
if not style and M._style then
require("tokyonight.config").options.style = M._style
require("farout.config").options.style = M._style
M._style = nil
end
M.load({ style = style, use_background = style == nil })
@@ -18,7 +18,7 @@ end
---@param opts Config|nil
function M.load(opts)
if opts then
require("tokyonight.config").extend(opts)
require("farout.config").extend(opts)
end
util.load(theme.setup())
end

View File

@@ -1,5 +1,5 @@
local util = require("tokyonight.util")
local colors = require("tokyonight.colors")
local util = require("farout.util")
local colors = require("farout.colors")
local M = {}
--
@@ -14,7 +14,7 @@ local M = {}
---@return Theme
function M.setup()
local config = require("tokyonight.config")
local config = require("farout.config")
local options = config.options
---@class Theme
---@field highlights Highlights

View File

@@ -1,4 +1,4 @@
local ts = require("tokyonight.treesitter")
local ts = require("farout.treesitter")
local M = {}
@@ -37,7 +37,7 @@ function M.lighten(hex, amount, fg)
end
function M.invert_color(color)
local hsluv = require("tokyonight.hsluv")
local hsluv = require("farout.hsluv")
if color ~= "NONE" then
local hsl = hsluv.hex_to_hsluv(color)
hsl[3] = 100 - hsl[3]
@@ -71,7 +71,7 @@ end
---@param config Config
function M.autocmds(config)
local group = vim.api.nvim_create_augroup("tokyonight", { clear = true })
local group = vim.api.nvim_create_augroup("farout", { clear = true })
vim.api.nvim_create_autocmd("ColorSchemePre", {
group = group,
@@ -187,7 +187,7 @@ function M.load(theme)
end
vim.o.termguicolors = true
vim.g.colors_name = "tokyonight"
vim.g.colors_name = "farout"
if ts.new_style() then
for group, colors in pairs(ts.defaults) do

View File

@@ -1,8 +1,8 @@
local colors = require("tokyonight.colors").setup({ transform = true })
local colors = require("farout.colors").setup({ transform = true })
local tokyonight = {}
local farout = {}
tokyonight.normal = {
farout.normal = {
left = { { colors.black, colors.blue }, { colors.blue, colors.fg_gutter } },
middle = { { colors.fg, colors.bg_statusline } },
right = { { colors.black, colors.blue }, { colors.blue, colors.fg_gutter } },
@@ -10,29 +10,29 @@ tokyonight.normal = {
warning = { { colors.black, colors.warning } },
}
tokyonight.insert = {
farout.insert = {
left = { { colors.black, colors.green }, { colors.blue, colors.bg } },
}
tokyonight.visual = {
farout.visual = {
left = { { colors.black, colors.magenta }, { colors.blue, colors.bg } },
}
tokyonight.replace = {
farout.replace = {
left = { { colors.black, colors.red }, { colors.blue, colors.bg } },
}
tokyonight.inactive = {
farout.inactive = {
left = { { colors.blue, colors.bg_statusline }, { colors.dark3, colors.bg } },
middle = { { colors.fg_gutter, colors.bg_statusline } },
right = { { colors.fg_gutter, colors.bg_statusline }, { colors.dark3, colors.bg } },
}
tokyonight.tabline = {
farout.tabline = {
left = { { colors.dark3, colors.bg_highlight }, { colors.dark3, colors.bg } },
middle = { { colors.fg_gutter, colors.bg_statusline } },
right = { { colors.fg_gutter, colors.bg_statusline }, { colors.dark3, colors.bg } },
tabsel = { { colors.blue, colors.fg_gutter }, { colors.dark3, colors.bg } },
}
return tokyonight
return farout

View File

@@ -1,49 +1,49 @@
local colors = require("tokyonight.colors").setup({ transform = true })
local config = require("tokyonight.config").options
local colors = require("farout.colors").setup({ transform = true })
local config = require("farout.config").options
local tokyonight = {}
local farout = {}
tokyonight.normal = {
farout.normal = {
a = { bg = colors.blue, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.blue },
c = { bg = colors.bg_statusline, fg = colors.fg_sidebar },
}
tokyonight.insert = {
farout.insert = {
a = { bg = colors.green, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.green },
}
tokyonight.command = {
farout.command = {
a = { bg = colors.yellow, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.yellow },
}
tokyonight.visual = {
farout.visual = {
a = { bg = colors.magenta, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.magenta },
}
tokyonight.replace = {
farout.replace = {
a = { bg = colors.red, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.red },
}
tokyonight.terminal = {
a = {bg = colors.green1, fg = colors.black },
b = {bg = colors.fg_gutter, fg=colors.green1 },
farout.terminal = {
a = { bg = colors.green1, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.green1 },
}
tokyonight.inactive = {
farout.inactive = {
a = { bg = colors.bg_statusline, fg = colors.blue },
b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" },
c = { bg = colors.bg_statusline, fg = colors.fg_gutter },
}
if config.lualine_bold then
for _, mode in pairs(tokyonight) do
for _, mode in pairs(farout) do
mode.a.gui = "bold"
end
end
return tokyonight
return farout