Add EditorConfig and standardize code formatting

Adds an EditorConfig file to maintain consistent coding styles across editors. Reformats code with consistent indentation using spaces instead of tabs. Makes minor color palette adjustments.
This commit is contained in:
Webhooked
2025-05-26 11:01:00 +02:00
parent 05b1a4b6d6
commit 90088255f9
8 changed files with 501 additions and 467 deletions
+45
View File
@@ -0,0 +1,45 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# Lua files
[*.lua]
indent_style = space
indent_size = 4
# Vim files
[*.vim]
indent_style = space
indent_size = 2
# Markdown files
[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
# YAML files
[*.{yml,yaml}]
indent_style = space
indent_size = 2
# TOML files
[*.toml]
indent_style = space
indent_size = 2
# Shell scripts
[*.sh]
indent_style = space
indent_size = 2
# Config files
[*.conf]
indent_style = space
indent_size = 2
+32 -32
View File
@@ -1,40 +1,40 @@
local config = { local config = {
force_reverse_video_cursor = true, force_reverse_video_cursor = true,
colors = { colors = {
foreground = "#C5C9C7", foreground = "#C5C9C7",
background = "#14171d", background = "#14171d",
cursor_bg = "#C5C9C7", cursor_bg = "#C5C9C7",
cursor_fg = "#14171d", cursor_fg = "#14171d",
cursor_border = "#C5C9C7", cursor_border = "#C5C9C7",
selection_fg = "#C5C9C7", selection_fg = "#C5C9C7",
selection_bg = "#393B42", selection_bg = "#393B42",
scrollbar_thumb = "#393B42", scrollbar_thumb = "#393B42",
split = "#393B42", split = "#393B42",
ansi = { ansi = {
"#14171d", "#14171d",
"#C4746E", "#C4746E",
"#8A9A7B", "#8A9A7B",
"#C4B28A", "#C4B28A",
"#8BA4B0", "#8BA4B0",
"#A292A3", "#A292A3",
"#8EA4A2", "#8EA4A2",
"#A4A7A4", "#A4A7A4",
}, },
brights = { brights = {
"#A4A7A4", "#A4A7A4",
"#E46876", "#E46876",
"#87A987", "#87A987",
"#E6C384", "#E6C384",
"#7FB4CA", "#7FB4CA",
"#938AA9", "#938AA9",
"#7AA89F", "#7AA89F",
"#C5C9C7", "#C5C9C7",
}, },
}, },
} }
return config return config
+32 -32
View File
@@ -1,40 +1,40 @@
local config = { local config = {
force_reverse_video_cursor = true, force_reverse_video_cursor = true,
colors = { colors = {
foreground = "#C5C9C7", foreground = "#C5C9C7",
background = "#090E13", background = "#090E13",
cursor_bg = "#090E13", cursor_bg = "#090E13",
cursor_fg = "#C5C9C7", cursor_fg = "#C5C9C7",
cursor_border = "#C5C9C7", cursor_border = "#C5C9C7",
selection_fg = "#C5C9C7", selection_fg = "#C5C9C7",
selection_bg = "#24262D", selection_bg = "#24262D",
scrollbar_thumb = "#24262D", scrollbar_thumb = "#24262D",
split = "#24262D", split = "#24262D",
ansi = { ansi = {
"#090E13", "#090E13",
"#C4746E", "#C4746E",
"#8A9A7B", "#8A9A7B",
"#C4B28A", "#C4B28A",
"#8BA4B0", "#8BA4B0",
"#A292A3", "#A292A3",
"#8EA4A2", "#8EA4A2",
"#A4A7A4", "#A4A7A4",
}, },
brights = { brights = {
"#A4A7A4", "#A4A7A4",
"#E46876", "#E46876",
"#87A987", "#87A987",
"#E6C384", "#E6C384",
"#7FB4CA", "#7FB4CA",
"#938AA9", "#938AA9",
"#7AA89F", "#7AA89F",
"#C5C9C7", "#C5C9C7",
}, },
}, },
} }
return config return config
+7 -17
View File
@@ -21,34 +21,23 @@ local palette = {
autumnYellow = "#DCA561", autumnYellow = "#DCA561",
-- Diag -- Diag
samuraiRed = "#E82424", samuraiRed = "#C34043",
roninYellow = "#FF9E3B", roninYellow = "#DCA561",
zenAqua1 = "#6A9589", zenAqua1 = "#6A9589",
inkBlue = "#658594", inkBlue = "#658594",
-- Fg and Comments -- Fg and Comments
oldWhite = "#C5C9C7", oldWhite = "#C5C9C7",
fujiWhite = "#f2f1ef", fujiWhite = "#f2f1ef",
fujiGray = "#727169",
oniViolet = "#957FB8",
oniViolet2 = "#b8b4d0",
crystalBlue = "#7E9CD8",
springViolet1 = "#938AA9", springViolet1 = "#938AA9",
springViolet2 = "#9CABCA",
springBlue = "#7FB4CA", springBlue = "#7FB4CA",
lightBlue = "#A3D4D5",
zenAqua2 = "#7AA89F", zenAqua2 = "#7AA89F",
springGreen = "#98BB6C", springGreen = "#98BB6C",
boatYellow1 = "#938056",
boatYellow2 = "#C0A36E",
carpYellow = "#E6C384", carpYellow = "#E6C384",
sakuraPink = "#D27E99",
zenRed = "#E46876", zenRed = "#E46876",
peachRed = "#FF5D62",
surimiOrange = "#FFA066",
katanaGray = "#717C7C", katanaGray = "#717C7C",
inkBlack0 = "#14171d", inkBlack0 = "#14171d",
@@ -63,7 +52,7 @@ local palette = {
inkOrange = "#b6927b", inkOrange = "#b6927b",
inkOrange2 = "#b98d7b", inkOrange2 = "#b98d7b",
inkGray = "#A4A7A4", inkGray = "#A4A7A4",
inkGray1 = "#9E9B93", inkGray1 = "#909398",
inkGray2 = "#75797f", inkGray2 = "#75797f",
inkGray3 = "#5C6066", inkGray3 = "#5C6066",
inkBlue2 = "#8ba4b0", inkBlue2 = "#8ba4b0",
@@ -133,7 +122,8 @@ function M.setup(opts)
if not theme then if not theme then
error( error(
"kanso.colors.setup(): Unable to infer `theme`. Either specify a theme or call this function after ':colorscheme kanso'") "kanso.colors.setup(): Unable to infer `theme`. Either specify a theme or call this function after ':colorscheme kanso'"
)
end end
-- Add to and/or override palette_colors -- Add to and/or override palette_colors
@@ -143,8 +133,8 @@ function M.setup(opts)
local theme_colors = require("kanso.themes")[theme](updated_palette_colors) local theme_colors = require("kanso.themes")[theme](updated_palette_colors)
-- Add to and/or override theme_colors -- Add to and/or override theme_colors
local theme_overrides = vim.tbl_deep_extend("force", override_colors.theme["all"] or {}, local theme_overrides =
override_colors.theme[theme] or {}) vim.tbl_deep_extend("force", override_colors.theme["all"] or {}, override_colors.theme[theme] or {})
local updated_theme_colors = vim.tbl_deep_extend("force", theme_colors, theme_overrides) local updated_theme_colors = vim.tbl_deep_extend("force", theme_colors, theme_overrides)
-- return palette_colors AND theme_colors -- return palette_colors AND theme_colors
+60 -60
View File
@@ -8,90 +8,90 @@ local M = {}
--- default config --- default config
---@class KansoConfig ---@class KansoConfig
M.config = { M.config = {
bold = true, bold = true,
undercurl = true, undercurl = true,
commentStyle = { italic = true }, commentStyle = { italic = true },
functionStyle = {}, functionStyle = {},
keywordStyle = { italic = true }, keywordStyle = { italic = true },
statementStyle = {}, statementStyle = {},
typeStyle = {}, typeStyle = {},
transparent = false, transparent = false,
dimInactive = false, dimInactive = false,
terminalColors = true, terminalColors = true,
disableItalics = false, disableItalics = false,
colors = { theme = { zen = {}, pearl = {}, ink = {}, all = {} }, palette = {} }, colors = { theme = { zen = {}, pearl = {}, ink = {}, all = {} }, palette = {} },
---@type fun(colors: KansoColorsSpec): table<string, table> ---@type fun(colors: KansoColorsSpec): table<string, table>
overrides = function() overrides = function()
return {} return {}
end, end,
---@type { dark: string, light: string } ---@type { dark: string, light: string }
background = { dark = "ink", light = "pearl" }, background = { dark = "ink", light = "pearl" },
theme = "ink", theme = "ink",
compile = false, compile = false,
} }
local function check_config(config) local function check_config(config)
local err local err
return not err return not err
end end
--- update global configuration with user settings --- update global configuration with user settings
---@param config? KansoConfig user configuration ---@param config? KansoConfig user configuration
function M.setup(config) function M.setup(config)
if check_config(config) then if check_config(config) then
M.config = vim.tbl_deep_extend("force", M.config, config or {}) M.config = vim.tbl_deep_extend("force", M.config, config or {})
else else
vim.notify("Kanso: Errors found while loading user config. Using default config.", vim.log.levels.ERROR) vim.notify("Kanso: Errors found while loading user config. Using default config.", vim.log.levels.ERROR)
end end
end end
--- load the colorscheme --- load the colorscheme
---@param theme? string ---@param theme? string
function M.load(theme) function M.load(theme)
local utils = require("kanso.utils") local utils = require("kanso.utils")
theme = theme or M.config.background[vim.o.background] or M.config.theme theme = theme or M.config.background[vim.o.background] or M.config.theme
M._CURRENT_THEME = theme M._CURRENT_THEME = theme
if vim.g.colors_name then if vim.g.colors_name then
vim.cmd("hi clear") vim.cmd("hi clear")
end end
vim.g.colors_name = "kanso" vim.g.colors_name = "kanso"
vim.o.termguicolors = true vim.o.termguicolors = true
if M.config.compile then if M.config.compile then
if utils.load_compiled(theme) then if utils.load_compiled(theme) then
return return
end end
M.compile() M.compile()
utils.load_compiled(theme) utils.load_compiled(theme)
else else
local colors = require("kanso.colors").setup({ theme = theme, colors = M.config.colors }) local colors = require("kanso.colors").setup({ theme = theme, colors = M.config.colors })
local highlights = require("kanso.highlights").setup(colors, M.config) local highlights = require("kanso.highlights").setup(colors, M.config)
require("kanso.highlights").highlight(highlights, M.config.terminalColors and colors.theme.term or {}) require("kanso.highlights").highlight(highlights, M.config.terminalColors and colors.theme.term or {})
end end
end end
function M.compile() function M.compile()
for theme, _ in pairs(require("kanso.themes")) do for theme, _ in pairs(require("kanso.themes")) do
local colors = require("kanso.colors").setup({ theme = theme, colors = M.config.colors }) local colors = require("kanso.colors").setup({ theme = theme, colors = M.config.colors })
local highlights = require("kanso.highlights").setup(colors, M.config) local highlights = require("kanso.highlights").setup(colors, M.config)
require("kanso.utils").compile(theme, highlights, M.config.terminalColors and colors.theme.term or {}) require("kanso.utils").compile(theme, highlights, M.config.terminalColors and colors.theme.term or {})
end end
end end
vim.api.nvim_create_user_command("KansoCompile", function() vim.api.nvim_create_user_command("KansoCompile", function()
for mod, _ in pairs(package.loaded) do for mod, _ in pairs(package.loaded) do
if mod:match("^kanso%.") then if mod:match("^kanso%.") then
package.loaded[mod] = nil package.loaded[mod] = nil
end end
end end
M.compile() M.compile()
vim.notify("Kanso: compiled successfully!", vim.log.levels.INFO) vim.notify("Kanso: compiled successfully!", vim.log.levels.INFO)
M.load(M._CURRENT_THEME) M.load(M._CURRENT_THEME)
vim.api.nvim_exec_autocmds("ColorScheme", { modeline = false }) vim.api.nvim_exec_autocmds("ColorScheme", { modeline = false })
end, {}) end, {})
return M return M
+104 -105
View File
@@ -24,7 +24,6 @@ local hsluv = {}
local hexChars = "0123456789abcdef" local hexChars = "0123456789abcdef"
local distance_line_from_origin = function(line) local distance_line_from_origin = function(line)
return math.abs(line.intercept) / math.sqrt((line.slope ^ 2) + 1) return math.abs(line.intercept) / math.sqrt((line.slope ^ 2) + 1)
end end
@@ -34,66 +33,66 @@ local length_of_ray_until_intersect = function(theta, line)
end end
hsluv.get_bounds = function(l) hsluv.get_bounds = function(l)
local result = {}; local result = {}
local sub2; local sub2
local sub1 = ((l + 16) ^ 3) / 1560896; local sub1 = ((l + 16) ^ 3) / 1560896
if sub1 > hsluv.epsilon then if sub1 > hsluv.epsilon then
sub2 = sub1; sub2 = sub1
else else
sub2 = l / hsluv.kappa; sub2 = l / hsluv.kappa
end end
for i = 1, 3 do for i = 1, 3 do
local m1 = hsluv.m[i][1]; local m1 = hsluv.m[i][1]
local m2 = hsluv.m[i][2]; local m2 = hsluv.m[i][2]
local m3 = hsluv.m[i][3]; local m3 = hsluv.m[i][3]
for t = 0, 1 do for t = 0, 1 do
local top1 = (284517 * m1 - 94839 * m3) * sub2; local top1 = (284517 * m1 - 94839 * m3) * sub2
local top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * l * sub2 - 769860 * t * l; local top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * l * sub2 - 769860 * t * l
local bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t; local bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t
table.insert(result, { table.insert(result, {
slope = top1 / bottom, slope = top1 / bottom,
intercept = top2 / bottom intercept = top2 / bottom,
}) })
end; end
end; end
return result return result
end end
hsluv.max_safe_chroma_for_l = function(l) hsluv.max_safe_chroma_for_l = function(l)
local bounds = hsluv.get_bounds(l); local bounds = hsluv.get_bounds(l)
local min = 1.7976931348623157e+308; local min = 1.7976931348623157e+308
for i = 1, 6 do for i = 1, 6 do
local length = distance_line_from_origin(bounds[i]); local length = distance_line_from_origin(bounds[i])
if length >= 0 then if length >= 0 then
min = math.min(min, length); min = math.min(min, length)
end; end
end; end
return min; return min
end end
hsluv.max_safe_chroma_for_lh = function(l, h) hsluv.max_safe_chroma_for_lh = function(l, h)
local hrad = h / 360 * math.pi * 2; local hrad = h / 360 * math.pi * 2
local bounds = hsluv.get_bounds(l); local bounds = hsluv.get_bounds(l)
local min = 1.7976931348623157e+308; local min = 1.7976931348623157e+308
for i = 1, 6 do for i = 1, 6 do
local bound = bounds[i]; local bound = bounds[i]
local length = length_of_ray_until_intersect(hrad, bound); local length = length_of_ray_until_intersect(hrad, bound)
if length >= 0 then if length >= 0 then
min = math.min(min, length); min = math.min(min, length)
end; end
end; end
return min return min
end end
hsluv.dot_product = function(a, b) hsluv.dot_product = function(a, b)
local sum = 0; local sum = 0
for i = 1, 3 do for i = 1, 3 do
sum = sum + a[i] * b[i]; sum = sum + a[i] * b[i]
end; end
return sum return sum
end end
@@ -102,7 +101,7 @@ hsluv.from_linear = function(c)
return 12.92 * c return 12.92 * c
else else
return 1.055 * (c ^ 0.416666666666666685) - 0.055 return 1.055 * (c ^ 0.416666666666666685) - 0.055
end; end
end end
hsluv.to_linear = function(c) hsluv.to_linear = function(c)
@@ -110,14 +109,14 @@ hsluv.to_linear = function(c)
return ((c + 0.055) / 1.055) ^ 2.4 return ((c + 0.055) / 1.055) ^ 2.4
else else
return c / 12.92 return c / 12.92
end; end
end end
hsluv.xyz_to_rgb = function(tuple) hsluv.xyz_to_rgb = function(tuple)
return { return {
hsluv.from_linear(hsluv.dot_product(hsluv.m[1], tuple)), hsluv.from_linear(hsluv.dot_product(hsluv.m[1], tuple)),
hsluv.from_linear(hsluv.dot_product(hsluv.m[2], tuple)), hsluv.from_linear(hsluv.dot_product(hsluv.m[2], tuple)),
hsluv.from_linear(hsluv.dot_product(hsluv.m[3], tuple)) hsluv.from_linear(hsluv.dot_product(hsluv.m[3], tuple)),
} }
end end
@@ -125,12 +124,12 @@ hsluv.rgb_to_xyz = function(tuple)
local rgbl = { local rgbl = {
hsluv.to_linear(tuple[1]), hsluv.to_linear(tuple[1]),
hsluv.to_linear(tuple[2]), hsluv.to_linear(tuple[2]),
hsluv.to_linear(tuple[3]) hsluv.to_linear(tuple[3]),
}; }
return { return {
hsluv.dot_product(hsluv.minv[1], rgbl), hsluv.dot_product(hsluv.minv[1], rgbl),
hsluv.dot_product(hsluv.minv[2], rgbl), hsluv.dot_product(hsluv.minv[2], rgbl),
hsluv.dot_product(hsluv.minv[3], rgbl) hsluv.dot_product(hsluv.minv[3], rgbl),
} }
end end
@@ -139,7 +138,7 @@ hsluv.y_to_l = function(Y)
return Y / hsluv.refY * hsluv.kappa return Y / hsluv.refY * hsluv.kappa
else else
return 116 * ((Y / hsluv.refY) ^ 0.333333333333333315) - 16 return 116 * ((Y / hsluv.refY) ^ 0.333333333333333315) - 16
end; end
end end
hsluv.l_to_y = function(L) hsluv.l_to_y = function(L)
@@ -147,131 +146,131 @@ hsluv.l_to_y = function(L)
return hsluv.refY * L / hsluv.kappa return hsluv.refY * L / hsluv.kappa
else else
return hsluv.refY * (((L + 16) / 116) ^ 3) return hsluv.refY * (((L + 16) / 116) ^ 3)
end; end
end end
hsluv.xyz_to_luv = function(tuple) hsluv.xyz_to_luv = function(tuple)
local X = tuple[1]; local X = tuple[1]
local Y = tuple[2]; local Y = tuple[2]
local divider = X + 15 * Y + 3 * tuple[3]; local divider = X + 15 * Y + 3 * tuple[3]
local varU = 4 * X; local varU = 4 * X
local varV = 9 * Y; local varV = 9 * Y
if divider ~= 0 then if divider ~= 0 then
varU = varU / divider; varU = varU / divider
varV = varV / divider; varV = varV / divider
else else
varU = 0; varU = 0
varV = 0; varV = 0
end end
local L = hsluv.y_to_l(Y); local L = hsluv.y_to_l(Y)
if L == 0 then if L == 0 then
return { 0, 0, 0 } return { 0, 0, 0 }
end; end
return { L, 13 * L * (varU - hsluv.refU), 13 * L * (varV - hsluv.refV) } return { L, 13 * L * (varU - hsluv.refU), 13 * L * (varV - hsluv.refV) }
end end
hsluv.luv_to_xyz = function(tuple) hsluv.luv_to_xyz = function(tuple)
local L = tuple[1]; local L = tuple[1]
local U = tuple[2]; local U = tuple[2]
local V = tuple[3]; local V = tuple[3]
if L == 0 then if L == 0 then
return { 0, 0, 0 } return { 0, 0, 0 }
end; end
local varU = U / (13 * L) + hsluv.refU; local varU = U / (13 * L) + hsluv.refU
local varV = V / (13 * L) + hsluv.refV; local varV = V / (13 * L) + hsluv.refV
local Y = hsluv.l_to_y(L); local Y = hsluv.l_to_y(L)
local X = 0 - (9 * Y * varU) / ((((varU - 4) * varV) - varU * varV)); local X = 0 - (9 * Y * varU) / (((varU - 4) * varV) - varU * varV)
return { X, Y, (9 * Y - 15 * varV * Y - varV * X) / (3 * varV) } return { X, Y, (9 * Y - 15 * varV * Y - varV * X) / (3 * varV) }
end end
hsluv.luv_to_lch = function(tuple) hsluv.luv_to_lch = function(tuple)
local L = tuple[1]; local L = tuple[1]
local U = tuple[2]; local U = tuple[2]
local V = tuple[3]; local V = tuple[3]
local C = math.sqrt(U * U + V * V); local C = math.sqrt(U * U + V * V)
local H local H
if C < 0.00000001 then if C < 0.00000001 then
H = 0; H = 0
else else
H = math.atan2(V, U) * 180.0 / 3.1415926535897932; H = math.atan2(V, U) * 180.0 / 3.1415926535897932
if H < 0 then if H < 0 then
H = 360 + H; H = 360 + H
end; end
end; end
return { L, C, H } return { L, C, H }
end end
hsluv.lch_to_luv = function(tuple) hsluv.lch_to_luv = function(tuple)
local L = tuple[1]; local L = tuple[1]
local C = tuple[2]; local C = tuple[2]
local Hrad = tuple[3] / 360.0 * 2 * math.pi; local Hrad = tuple[3] / 360.0 * 2 * math.pi
return { L, math.cos(Hrad) * C, math.sin(Hrad) * C }; return { L, math.cos(Hrad) * C, math.sin(Hrad) * C }
end end
hsluv.hsluv_to_lch = function(tuple) hsluv.hsluv_to_lch = function(tuple)
local H = tuple[1]; local H = tuple[1]
local S = tuple[2]; local S = tuple[2]
local L = tuple[3]; local L = tuple[3]
if L > 99.9999999 then if L > 99.9999999 then
return { 100, 0, H } return { 100, 0, H }
end; end
if L < 0.00000001 then if L < 0.00000001 then
return { 0, 0, H } return { 0, 0, H }
end; end
return { L, hsluv.max_safe_chroma_for_lh(L, H) / 100 * S, H } return { L, hsluv.max_safe_chroma_for_lh(L, H) / 100 * S, H }
end end
hsluv.lch_to_hsluv = function(tuple) hsluv.lch_to_hsluv = function(tuple)
local L = tuple[1]; local L = tuple[1]
local C = tuple[2]; local C = tuple[2]
local H = tuple[3]; local H = tuple[3]
local max_chroma = hsluv.max_safe_chroma_for_lh(L, H) local max_chroma = hsluv.max_safe_chroma_for_lh(L, H)
if L > 99.9999999 then if L > 99.9999999 then
return { H, 0, 100 } return { H, 0, 100 }
end; end
if L < 0.00000001 then if L < 0.00000001 then
return { H, 0, 0 } return { H, 0, 0 }
end; end
return { H, C / max_chroma * 100, L } return { H, C / max_chroma * 100, L }
end end
hsluv.hpluv_to_lch = function(tuple) hsluv.hpluv_to_lch = function(tuple)
local H = tuple[1]; local H = tuple[1]
local S = tuple[2]; local S = tuple[2]
local L = tuple[3]; local L = tuple[3]
if L > 99.9999999 then if L > 99.9999999 then
return { 100, 0, H } return { 100, 0, H }
end; end
if L < 0.00000001 then if L < 0.00000001 then
return { 0, 0, H } return { 0, 0, H }
end; end
return { L, hsluv.max_safe_chroma_for_l(L) / 100 * S, H } return { L, hsluv.max_safe_chroma_for_l(L) / 100 * S, H }
end end
hsluv.lch_to_hpluv = function(tuple) hsluv.lch_to_hpluv = function(tuple)
local L = tuple[1]; local L = tuple[1]
local C = tuple[2]; local C = tuple[2]
local H = tuple[3]; local H = tuple[3]
if L > 99.9999999 then if L > 99.9999999 then
return { H, 0, 100 } return { H, 0, 100 }
end; end
if L < 0.00000001 then if L < 0.00000001 then
return { H, 0, 0 } return { H, 0, 0 }
end; end
return { H, C / hsluv.max_safe_chroma_for_l(L) * 100, L } return { H, C / hsluv.max_safe_chroma_for_l(L) * 100, L }
end end
hsluv.rgb_to_hex = function(tuple) hsluv.rgb_to_hex = function(tuple)
local h = "#"; local h = "#"
for i = 1, 3 do for i = 1, 3 do
local c = math.floor(tuple[i] * 255 + 0.5); local c = math.floor(tuple[i] * 255 + 0.5)
local digit2 = math.fmod(c, 16); local digit2 = math.fmod(c, 16)
local x = (c - digit2) / 16; local x = (c - digit2) / 16
local digit1 = math.floor(x); local digit1 = math.floor(x)
h = h .. string.sub(hexChars, digit1 + 1, digit1 + 1) h = h .. string.sub(hexChars, digit1 + 1, digit1 + 1)
h = h .. string.sub(hexChars, digit2 + 1, digit2 + 1) h = h .. string.sub(hexChars, digit2 + 1, digit2 + 1)
end; end
return h return h
end end
@@ -279,12 +278,12 @@ hsluv.hex_to_rgb = function(hex)
hex = string.lower(hex) hex = string.lower(hex)
local ret = {} local ret = {}
for i = 0, 2 do for i = 0, 2 do
local char1 = string.sub(hex, i * 2 + 2, i * 2 + 2); local char1 = string.sub(hex, i * 2 + 2, i * 2 + 2)
local char2 = string.sub(hex, i * 2 + 3, i * 2 + 3); local char2 = string.sub(hex, i * 2 + 3, i * 2 + 3)
local digit1 = string.find(hexChars, char1) - 1 local digit1 = string.find(hexChars, char1) - 1
local digit2 = string.find(hexChars, char2) - 1 local digit2 = string.find(hexChars, char2) - 1
ret[i + 1] = (digit1 * 16 + digit2) / 255.0; ret[i + 1] = (digit1 * 16 + digit2) / 255.0
end; end
return ret return ret
end end
@@ -331,12 +330,12 @@ end
hsluv.m = { hsluv.m = {
{ 3.240969941904521, -1.537383177570093, -0.498610760293 }, { 3.240969941904521, -1.537383177570093, -0.498610760293 },
{ -0.96924363628087, 1.87596750150772, 0.041555057407175 }, { -0.96924363628087, 1.87596750150772, 0.041555057407175 },
{ 0.055630079696993, -0.20397695888897, 1.056971514242878 } { 0.055630079696993, -0.20397695888897, 1.056971514242878 },
} }
hsluv.minv = { hsluv.minv = {
{ 0.41239079926595, 0.35758433938387, 0.18048078840183 }, { 0.41239079926595, 0.35758433938387, 0.18048078840183 },
{ 0.21263900587151, 0.71516867876775, 0.072192315360733 }, { 0.21263900587151, 0.71516867876775, 0.072192315360733 },
{ 0.019330818715591, 0.11919477979462, 0.95053215224966 } { 0.019330818715591, 0.11919477979462, 0.95053215224966 },
} }
hsluv.refY = 1.0 hsluv.refY = 1.0
hsluv.refU = 0.19783000664283 hsluv.refU = 0.19783000664283
+220 -220
View File
@@ -98,109 +98,109 @@ return {
zen = function(palette) zen = function(palette)
return { return {
ui = { ui = {
none = "NONE", none = "NONE",
fg = palette.inkWhite, fg = palette.inkWhite,
fg_dim = palette.oldWhite, fg_dim = palette.oldWhite,
fg_reverse = palette.zenBlue1, fg_reverse = palette.zenBlue1,
bg_dim = palette.zen0, bg_dim = palette.zen0,
bg_m3 = palette.zen0, bg_m3 = palette.zen0,
bg_m2 = palette.zen0, bg_m2 = palette.zen0,
bg_m1 = palette.zen0, bg_m1 = palette.zen0,
bg = palette.zen0, bg = palette.zen0,
bg_p1 = palette.zen1, bg_p1 = palette.zen1,
bg_p2 = palette.zen2, bg_p2 = palette.zen2,
special = palette.inkGray3, special = palette.inkGray3,
indent_line = palette.inkBlack2, indent_line = palette.inkBlack2,
active_indent_line = palette.inkBlack3, active_indent_line = palette.inkBlack3,
whitespace = palette.inkBlack0, whitespace = palette.inkBlack0,
nontext = palette.inkAsh, nontext = palette.inkAsh,
bg_visual = palette.inkBlack3, bg_visual = palette.inkBlack3,
bg_search = palette.zenBlue2, bg_search = palette.zenBlue2,
cursor_line_nr_foreground = palette.inkGray3, cursor_line_nr_foreground = palette.inkGray3,
cursor_line_nr_active_foreground = palette.fujiWhite, cursor_line_nr_active_foreground = palette.fujiWhite,
cursor_bg = palette.fujiWhite, cursor_bg = palette.fujiWhite,
cursor_fg = palette.zen0, cursor_fg = palette.zen0,
pmenu = { pmenu = {
fg = palette.fujiWhite, fg = palette.fujiWhite,
fg_sel = "NONE", fg_sel = "NONE",
bg = palette.zen0, bg = palette.zen0,
bg_sel = palette.inkBlack3, bg_sel = palette.inkBlack3,
bg_thumb = palette.inkBlack3, bg_thumb = palette.inkBlack3,
bg_sbar = palette.zen0, bg_sbar = palette.zen0,
}, },
float = { float = {
fg = palette.oldWhite, fg = palette.oldWhite,
bg = palette.zen0, bg = palette.zen0,
fg_border = palette.zen2, fg_border = palette.zen2,
bg_border = palette.zen0, bg_border = palette.zen0,
}, },
}, },
syn = { syn = {
string = palette.inkGreen2, string = palette.inkGreen2,
variable = "NONE", variable = "NONE",
number = palette.inkPink, number = palette.inkPink,
constant = palette.inkOrange, constant = palette.inkOrange,
identifier = palette.inkViolet, identifier = palette.inkViolet,
parameter = palette.inkGray1, parameter = palette.inkGray1,
fun = palette.inkBlue2, fun = palette.inkBlue2,
statement = palette.inkViolet, statement = palette.inkViolet,
keyword = palette.inkViolet, keyword = palette.inkViolet,
operator = palette.inkGray1, operator = palette.inkGray1,
preproc = palette.inkGray1, preproc = palette.inkGray1,
type = palette.inkAqua, type = palette.inkAqua,
regex = palette.inkRed, regex = palette.inkRed,
deprecated = palette.katanaGray, deprecated = palette.katanaGray,
punct = palette.inkGray1, punct = palette.inkGray1,
comment = palette.inkGray2, comment = palette.inkGray2,
special1 = palette.inkYellow, special1 = palette.inkYellow,
special2 = palette.inkViolet, special2 = palette.inkViolet,
special3 = palette.inkViolet, special3 = palette.inkViolet,
}, },
diag = { diag = {
error = palette.samuraiRed, error = palette.samuraiRed,
ok = palette.springGreen, ok = palette.springGreen,
warning = palette.roninYellow, warning = palette.roninYellow,
info = palette.inkBlue, info = palette.inkBlue,
hint = palette.zenAqua1, hint = palette.zenAqua1,
}, },
diff = { diff = {
add = palette.winterGreen, add = palette.winterGreen,
delete = palette.winterRed, delete = palette.winterRed,
change = palette.winterBlue, change = palette.winterBlue,
text = palette.winterYellow, text = palette.winterYellow,
}, },
vcs = { vcs = {
added = palette.autumnGreen, added = palette.autumnGreen,
removed = palette.autumnRed, removed = palette.autumnRed,
changed = palette.autumnYellow, changed = palette.autumnYellow,
untracked = palette.inkGray2 untracked = palette.inkGray2,
}, },
term = { term = {
palette.zen0, -- black palette.zen0, -- black
palette.inkRed, -- red palette.inkRed, -- red
palette.inkGreen2, -- green palette.inkGreen2, -- green
palette.inkYellow, -- yellow palette.inkYellow, -- yellow
palette.inkBlue2, -- blue palette.inkBlue2, -- blue
palette.inkPink, -- magenta palette.inkPink, -- magenta
palette.inkWhite, -- cyan palette.inkWhite, -- cyan
palette.oldWhite, -- white palette.oldWhite, -- white
palette.inkGray1, -- bright black palette.inkGray1, -- bright black
palette.zenRed, -- bright red palette.zenRed, -- bright red
palette.inkGreen, -- bright green palette.inkGreen, -- bright green
palette.carpYellow, -- bright yellow palette.carpYellow, -- bright yellow
palette.springBlue, -- bright blue palette.springBlue, -- bright blue
palette.springViolet1, -- bright magenta palette.springViolet1, -- bright magenta
palette.zenAqua2, -- bright cyan palette.zenAqua2, -- bright cyan
palette.inkWhite, -- bright white palette.inkWhite, -- bright white
palette.inkOrange, -- extended color 1 palette.inkOrange, -- extended color 1
palette.inkOrange2, -- extended color 2 palette.inkOrange2, -- extended color 2
}, },
} }
end, end,
@@ -209,109 +209,109 @@ return {
ink = function(palette) ink = function(palette)
return { return {
ui = { ui = {
none = "NONE", none = "NONE",
fg = palette.inkWhite, fg = palette.inkWhite,
fg_dim = palette.oldWhite, fg_dim = palette.oldWhite,
fg_reverse = palette.zenBlue1, fg_reverse = palette.zenBlue1,
bg_dim = palette.inkBlack0, bg_dim = palette.inkBlack0,
bg_m3 = palette.inkBlack0, bg_m3 = palette.inkBlack0,
bg_m2 = palette.inkBlack0, bg_m2 = palette.inkBlack0,
bg_m1 = palette.inkBlack0, bg_m1 = palette.inkBlack0,
bg = palette.inkBlack0, bg = palette.inkBlack0,
bg_p1 = palette.inkBlack1, bg_p1 = palette.inkBlack1,
bg_p2 = palette.inkBlack2, bg_p2 = palette.inkBlack2,
special = palette.inkGray3, special = palette.inkGray3,
indent_line = palette.inkBlack2, indent_line = palette.inkBlack2,
active_indent_line = palette.inkBlack3, active_indent_line = palette.inkBlack3,
whitespace = palette.inkBlack0, whitespace = palette.inkBlack0,
nontext = palette.inkAsh, nontext = palette.inkAsh,
bg_visual = palette.inkBlack3, bg_visual = palette.inkBlack3,
bg_search = palette.zenBlue2, bg_search = palette.zenBlue2,
cursor_line_nr_foreground = palette.inkGray3, cursor_line_nr_foreground = palette.inkGray3,
cursor_line_nr_active_foreground = palette.fujiWhite, cursor_line_nr_active_foreground = palette.fujiWhite,
cursor_bg = palette.fujiWhite, cursor_bg = palette.fujiWhite,
cursor_fg = palette.inkBlack0, cursor_fg = palette.inkBlack0,
pmenu = { pmenu = {
fg = palette.fujiWhite, fg = palette.fujiWhite,
fg_sel = "NONE", fg_sel = "NONE",
bg = palette.inkBlack0, bg = palette.inkBlack0,
bg_sel = palette.inkBlack3, bg_sel = palette.inkBlack3,
bg_thumb = palette.inkBlack3, bg_thumb = palette.inkBlack3,
bg_sbar = palette.inkBlack0, bg_sbar = palette.inkBlack0,
}, },
float = { float = {
fg = palette.oldWhite, fg = palette.oldWhite,
bg = palette.inkBlack0, bg = palette.inkBlack0,
fg_border = palette.inkBlack2, fg_border = palette.inkBlack2,
bg_border = palette.inkBlack0, bg_border = palette.inkBlack0,
}, },
}, },
syn = { syn = {
string = palette.inkGreen2, string = palette.inkGreen2,
variable = "NONE", variable = "NONE",
number = palette.inkPink, number = palette.inkPink,
constant = palette.inkOrange, constant = palette.inkOrange,
identifier = palette.inkViolet, identifier = palette.inkViolet,
parameter = palette.inkGray1, parameter = palette.inkGray1,
fun = palette.inkBlue2, fun = palette.inkBlue2,
statement = palette.inkViolet, statement = palette.inkViolet,
keyword = palette.inkViolet, keyword = palette.inkViolet,
operator = palette.inkGray1, operator = palette.inkGray1,
preproc = palette.inkGray1, preproc = palette.inkGray1,
type = palette.inkAqua, type = palette.inkAqua,
regex = palette.inkRed, regex = palette.inkRed,
deprecated = palette.katanaGray, deprecated = palette.katanaGray,
punct = palette.inkGray1, punct = palette.inkGray1,
comment = palette.inkGray2, comment = palette.inkGray2,
special1 = palette.inkYellow, special1 = palette.inkYellow,
special2 = palette.inkViolet, special2 = palette.inkViolet,
special3 = palette.inkViolet, special3 = palette.inkViolet,
}, },
diag = { diag = {
error = palette.samuraiRed, error = palette.samuraiRed,
ok = palette.springGreen, ok = palette.springGreen,
warning = palette.roninYellow, warning = palette.roninYellow,
info = palette.inkBlue, info = palette.inkBlue,
hint = palette.zenAqua1, hint = palette.zenAqua1,
}, },
diff = { diff = {
add = palette.winterGreen, add = palette.winterGreen,
delete = palette.winterRed, delete = palette.winterRed,
change = palette.winterBlue, change = palette.winterBlue,
text = palette.winterYellow, text = palette.winterYellow,
}, },
vcs = { vcs = {
added = palette.autumnGreen, added = palette.autumnGreen,
removed = palette.autumnRed, removed = palette.autumnRed,
changed = palette.autumnYellow, changed = palette.autumnYellow,
untracked = palette.inkGray2 untracked = palette.inkGray2,
}, },
term = { term = {
palette.inkBlack0, -- black palette.inkBlack0, -- black
palette.inkRed, -- red palette.inkRed, -- red
palette.inkGreen2, -- green palette.inkGreen2, -- green
palette.inkYellow, -- yellow palette.inkYellow, -- yellow
palette.inkBlue2, -- blue palette.inkBlue2, -- blue
palette.inkPink, -- magenta palette.inkPink, -- magenta
palette.inkWhite, -- cyan palette.inkWhite, -- cyan
palette.oldWhite, -- white palette.oldWhite, -- white
palette.inkGray1, -- bright black palette.inkGray1, -- bright black
palette.zenRed, -- bright red palette.zenRed, -- bright red
palette.inkGreen, -- bright green palette.inkGreen, -- bright green
palette.carpYellow, -- bright yellow palette.carpYellow, -- bright yellow
palette.springBlue, -- bright blue palette.springBlue, -- bright blue
palette.springViolet1, -- bright magenta palette.springViolet1, -- bright magenta
palette.zenAqua2, -- bright cyan palette.zenAqua2, -- bright cyan
palette.inkWhite, -- bright white palette.inkWhite, -- bright white
palette.inkOrange, -- extended color 1 palette.inkOrange, -- extended color 1
palette.inkOrange2, -- extended color 2 palette.inkOrange2, -- extended color 2
}, },
} }
end, end,
@@ -320,108 +320,108 @@ return {
pearl = function(palette) pearl = function(palette)
return { return {
ui = { ui = {
none = "NONE", none = "NONE",
fg = palette.pearlInk0, fg = palette.pearlInk0,
fg_dim = palette.pearlInk0, fg_dim = palette.pearlInk0,
fg_reverse = palette.pearlGray, fg_reverse = palette.pearlGray,
bg_dim = palette.pearlWhite0, bg_dim = palette.pearlWhite0,
bg_m3 = palette.pearlWhite0, bg_m3 = palette.pearlWhite0,
bg_m2 = palette.pearlWhite0, bg_m2 = palette.pearlWhite0,
bg_m1 = palette.pearlWhite0, bg_m1 = palette.pearlWhite0,
bg = palette.pearlWhite0, bg = palette.pearlWhite0,
bg_p1 = palette.pearlWhite1, bg_p1 = palette.pearlWhite1,
bg_p2 = palette.pearlWhite1, bg_p2 = palette.pearlWhite1,
nontext = palette.pearlViolet1, nontext = palette.pearlViolet1,
whitespace = palette.pearlWhite0, whitespace = palette.pearlWhite0,
special = palette.pearlViolet2, special = palette.pearlViolet2,
indent_line = palette.pearlWhite1, indent_line = palette.pearlWhite1,
active_indent_line = palette.pearlWhite2, active_indent_line = palette.pearlWhite2,
bg_visual = palette.pearlWhite2, bg_visual = palette.pearlWhite2,
bg_search = palette.pearlBlue2, bg_search = palette.pearlBlue2,
cursor_line_nr_foreground = palette.pearlGray4, cursor_line_nr_foreground = palette.pearlGray4,
cursor_line_nr_active_foreground = palette.inkBlack2, cursor_line_nr_active_foreground = palette.inkBlack2,
cursor_bg = palette.fujiWhite, cursor_bg = palette.fujiWhite,
cursor_fg = palette.inkBlack2, cursor_fg = palette.inkBlack2,
pmenu = { pmenu = {
fg = palette.pearlInk2, fg = palette.pearlInk2,
fg_sel = "NONE", -- This is important to make highlights pass-through fg_sel = "NONE", -- This is important to make highlights pass-through
bg = palette.pearlWhite0, bg = palette.pearlWhite0,
bg_sel = palette.pearlWhite2, bg_sel = palette.pearlWhite2,
bg_thumb = palette.pearlWhite2, bg_thumb = palette.pearlWhite2,
bg_sbar = palette.pearlWhite0, bg_sbar = palette.pearlWhite0,
}, },
float = { float = {
fg = palette.pearlInk2, fg = palette.pearlInk2,
bg = palette.pearlWhite0, bg = palette.pearlWhite0,
fg_border = palette.pearlWhite2, fg_border = palette.pearlWhite2,
bg_border = palette.pearlWhite0, bg_border = palette.pearlWhite0,
}, },
}, },
syn = { syn = {
string = palette.pearlGreen, string = palette.pearlGreen,
variable = "NONE", variable = "NONE",
number = palette.pearlPink, number = palette.pearlPink,
constant = palette.pearlOrange, constant = palette.pearlOrange,
identifier = palette.pearlViolet4, identifier = palette.pearlViolet4,
parameter = palette.pearlBlue5, parameter = palette.pearlBlue5,
fun = palette.pearlBlue4, fun = palette.pearlBlue4,
statement = palette.pearlViolet4, statement = palette.pearlViolet4,
keyword = palette.pearlViolet4, keyword = palette.pearlViolet4,
operator = palette.pearlGray3, operator = palette.pearlGray3,
preproc = palette.pearlGray2, preproc = palette.pearlGray2,
type = palette.pearlAqua, type = palette.pearlAqua,
regex = palette.pearlYellow2, regex = palette.pearlYellow2,
deprecated = palette.pearlGray3, deprecated = palette.pearlGray3,
comment = palette.pearlGray3, comment = palette.pearlGray3,
punct = palette.pearlGray3, punct = palette.pearlGray3,
special1 = palette.pearlYellow2, special1 = palette.pearlYellow2,
special2 = palette.pearlViolet4, special2 = palette.pearlViolet4,
special3 = palette.pearlViolet4, special3 = palette.pearlViolet4,
}, },
vcs = { vcs = {
added = palette.pearlGreen2, added = palette.pearlGreen2,
removed = palette.pearlRed2, removed = palette.pearlRed2,
changed = palette.pearlYellow3, changed = palette.pearlYellow3,
untracked = palette.pearlGray4 untracked = palette.pearlGray4,
}, },
diff = { diff = {
add = palette.pearlGreen3, add = palette.pearlGreen3,
delete = palette.pearlRed4, delete = palette.pearlRed4,
change = palette.pearlCyan, change = palette.pearlCyan,
text = palette.pearlYellow4, text = palette.pearlYellow4,
}, },
diag = { diag = {
error = palette.pearlRed3, error = palette.pearlRed3,
ok = palette.pearlGreen, ok = palette.pearlGreen,
warning = palette.pearlOrange2, warning = palette.pearlOrange2,
info = palette.pearlTeal3, info = palette.pearlTeal3,
hint = palette.pearlAqua2, hint = palette.pearlAqua2,
}, },
term = { term = {
palette.inkBlack2, -- black palette.inkBlack2, -- black
palette.pearlRed, -- red palette.pearlRed, -- red
palette.pearlGreen, -- green palette.pearlGreen, -- green
palette.pearlYellow, -- yellow palette.pearlYellow, -- yellow
palette.pearlBlue4, -- blue palette.pearlBlue4, -- blue
palette.pearlPink, -- magenta palette.pearlPink, -- magenta
palette.pearlAqua, -- cyan palette.pearlAqua, -- cyan
palette.pearlInk0, -- white palette.pearlInk0, -- white
palette.pearlGray3, -- bright black palette.pearlGray3, -- bright black
palette.pearlRed2, -- bright red palette.pearlRed2, -- bright red
palette.pearlGreen2, -- bright green palette.pearlGreen2, -- bright green
palette.pearlYellow2, -- bright yellow palette.pearlYellow2, -- bright yellow
palette.pearlTeal2, -- bright blue palette.pearlTeal2, -- bright blue
palette.pearlViolet4, -- bright magenta palette.pearlViolet4, -- bright magenta
palette.pearlAqua2, -- bright cyan palette.pearlAqua2, -- bright cyan
palette.pearlInk2, -- bright white palette.pearlInk2, -- bright white
palette.pearlOrange2, -- extended color 1 palette.pearlOrange2, -- extended color 1
palette.pearlRed3, -- extended color 2 palette.pearlRed3, -- extended color 2
}, },
} }
end, end,
+1 -1
View File
@@ -2,7 +2,7 @@ local M = {}
local PATH_SEP = vim.loop.os_uname().version:match("Windows") and "\\" or "/" local PATH_SEP = vim.loop.os_uname().version:match("Windows") and "\\" or "/"
local get_compiled_path = function(theme) local get_compiled_path = function(theme)
return table.concat({vim.fn.stdpath("state"), "kanso", theme .. "_compiled.lua"}, PATH_SEP) return table.concat({ vim.fn.stdpath("state"), "kanso", theme .. "_compiled.lua" }, PATH_SEP)
end end
---@return string theme ---@return string theme