Created
April 24, 2023 13:32
-
-
Save echasnovski/283c6676bd7b29124d56b0b262b09c69 to your computer and use it in GitHub Desktop.
Experiment with computing "average popular Neovim color scheme"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Made with 'mini.colors' module of https://github.com/echasnovski/mini.nvim | |
if vim.g.colors_name ~= nil then vim.cmd('highlight clear') end | |
vim.g.colors_name = "average_dark" | |
-- Highlight groups | |
local hi = vim.api.nvim_set_hl | |
hi(0, "@constant.builtin", { ctermfg = 146, fg = "#8ebbd3" }) | |
hi(0, "@constructor", { ctermfg = 110, fg = "#7fbce4" }) | |
hi(0, "@function.builtin", { ctermfg = 110, fg = "#89b6ce" }) | |
hi(0, "@lsp.type.comment", { ctermfg = 243, fg = "#697283" }) | |
hi(0, "@lsp.type.decorator", { ctermfg = 111, fg = "#82a6ec" }) | |
hi(0, "@lsp.type.enumMember", { ctermfg = 215, fg = "#f1a872" }) | |
hi(0, "@lsp.type.function", { ctermfg = 111, fg = "#82a6ec" }) | |
hi(0, "@lsp.type.parameter", { ctermfg = 146, fg = "#bbb4c8" }) | |
hi(0, "@lsp.type.property", { ctermfg = 117, fg = "#9bc6ff" }) | |
hi(0, "@lsp.type.type", { ctermfg = 144, fg = "#b9af90" }) | |
hi(0, "@parameter", { ctermfg = 250, fg = "#c0b5bc" }) | |
hi(0, "@string.escape", { ctermfg = 180, fg = "#e09c7e" }) | |
hi(0, "@string.regex", { ctermfg = 216, fg = "#d8c48b" }) | |
hi(0, "@tag.delimiter", { ctermfg = 116, fg = "#7fd2e1" }) | |
hi(0, "@text.literal", { ctermfg = 116, fg = "#7dcbbe" }) | |
hi(0, "@text.reference", { ctermfg = 247, fg = "#ad9f99" }) | |
hi(0, "@text.title", { ctermfg = 111, fg = "#7fa9ee" }) | |
hi(0, "@text.todo", { bg = "#bfbc85", ctermbg = 180, ctermfg = 235, fg = "#202937" }) | |
hi(0, "@text.uri", { underline = true }) | |
hi(0, "@variable", { ctermfg = 189, fg = "#cbd5f3" }) | |
hi(0, "@variable.builtin", { ctermfg = 211, fg = "#f37993" }) | |
hi(0, "Bold", { bold = true }) | |
hi(0, "Character", { ctermfg = 115, fg = "#87c3a9" }) | |
hi(0, "CmpItemAbbrDeprecated", { ctermfg = 243, fg = "#687186", strikethrough = true }) | |
hi(0, "CmpItemAbbrMatch", { ctermfg = 110, fg = "#86abdc" }) | |
hi(0, "CmpItemAbbrMatchFuzzy", { ctermfg = 110, fg = "#86abdc" }) | |
hi(0, "CmpItemKindClass", { ctermfg = 180, fg = "#cbb886" }) | |
hi(0, "CmpItemKindEnum", { ctermfg = 179, fg = "#dfbc7d" }) | |
hi(0, "CmpItemKindFunction", { ctermfg = 111, fg = "#82a6ec" }) | |
hi(0, "CmpItemKindInterface", { ctermfg = 180, fg = "#cdb786" }) | |
hi(0, "CmpItemKindMethod", { ctermfg = 111, fg = "#82a6ec" }) | |
hi(0, "CmpItemKindOperator", { ctermfg = 145, fg = "#aeafb0" }) | |
hi(0, "CmpItemKindSnippet", { ctermfg = 146, fg = "#a3aecd" }) | |
hi(0, "CmpItemKindStruct", { ctermfg = 249, fg = "#a7b8b5" }) | |
hi(0, "CmpItemKindValue", { ctermfg = 174, fg = "#da9b8d" }) | |
hi(0, "ColorColumn", { bg = "#292c3c", ctermbg = 236 }) | |
hi(0, "Comment", { ctermfg = 243, fg = "#697283" }) | |
hi(0, "Conceal", { ctermfg = 103, fg = "#7e849f" }) | |
hi(0, "Constant", { ctermfg = 215, fg = "#f1a872" }) | |
hi(0, "Cursor", { bg = "#ccd0d9", ctermbg = 252, ctermfg = 235, fg = "#1f2130" }) | |
hi(0, "CursorIM", { bg = "#ccd0d9", ctermbg = 252, ctermfg = 235, fg = "#1f2130" }) | |
hi(0, "CursorLine", { bg = "#2c3040", ctermbg = 236 }) | |
hi(0, "CursorLineNr", { ctermfg = 251, fg = "#c5c0c6" }) | |
hi(0, "DashboardCenter", { ctermfg = 144, fg = "#9abb80" }) | |
hi(0, "DashboardFooter", { ctermfg = 180, fg = "#d5bf8d" }) | |
hi(0, "DashboardHeader", { ctermfg = 111, fg = "#7ba5ea" }) | |
hi(0, "DashboardShortCut", { ctermfg = 116, fg = "#9cceda" }) | |
hi(0, "DiagnosticError", { ctermfg = 167, fg = "#d25263" }) | |
hi(0, "DiagnosticHint", { ctermfg = 108, fg = "#7fb29d" }) | |
hi(0, "DiagnosticInfo", { ctermfg = 74, fg = "#70aed5" }) | |
hi(0, "DiagnosticUnderlineError", { sp = "#d25263" }) | |
hi(0, "DiagnosticUnderlineInfo", { sp = "#70aed5" }) | |
hi(0, "DiagnosticUnderlineWarn", { sp = "#d4b568" }) | |
hi(0, "DiagnosticWarn", { ctermfg = 179, fg = "#d4b568" }) | |
hi(0, "DiffAdd", { bg = "#2f3c3d", ctermbg = 237 }) | |
hi(0, "DiffChange", { bg = "#25293c", ctermbg = 235 }) | |
hi(0, "DiffDelete", { bg = "#3f2d3d", ctermbg = 236 }) | |
hi(0, "DiffText", { bg = "#363a49", ctermbg = 237 }) | |
hi(0, "Directory", { ctermfg = 111, fg = "#7ba5ea" }) | |
hi(0, "EndOfBuffer", { ctermfg = 235, fg = "#1f2130" }) | |
hi(0, "Error", { ctermfg = 167, fg = "#d25263" }) | |
hi(0, "ErrorMsg", { ctermfg = 167, fg = "#d25263" }) | |
hi(0, "FloatBorder", { ctermfg = 246, fg = "#8395ae" }) | |
hi(0, "FoldColumn", { ctermfg = 243, fg = "#6b7089" }) | |
hi(0, "Folded", { bg = "#3e4256", ctermbg = 238, ctermfg = 110, fg = "#93a6bf" }) | |
hi(0, "Function", { ctermfg = 111, fg = "#82a6ec" }) | |
hi(0, "GitSignsAdd", { ctermfg = 65, fg = "#6c9a6d" }) | |
hi(0, "GitSignsChange", { ctermfg = 144, fg = "#c2b07d" }) | |
hi(0, "GitSignsDelete", { ctermfg = 131, fg = "#cb4f63" }) | |
hi(0, "Identifier", { ctermfg = 146, fg = "#bab6cc" }) | |
hi(0, "IncSearch", { bg = "#eda863", ctermbg = 179, ctermfg = 235, fg = "#1c212f" }) | |
hi(0, "Italic", { italic = true }) | |
hi(0, "Keyword", { ctermfg = 140, fg = "#b892da" }) | |
hi(0, "LineNr", { ctermfg = 239, fg = "#454a62" }) | |
hi(0, "LspReferenceRead", { bg = "#404456", ctermbg = 238 }) | |
hi(0, "LspReferenceText", { bg = "#404456", ctermbg = 238 }) | |
hi(0, "LspReferenceWrite", { bg = "#404456", ctermbg = 238 }) | |
hi(0, "MatchParen", { ctermfg = 215, fg = "#fbaf73" }) | |
hi(0, "ModeMsg", { bold = true, ctermfg = 251, fg = "#c0c2cb" }) | |
hi(0, "MoreMsg", { ctermfg = 104, fg = "#6d9bdf" }) | |
hi(0, "NonText", { ctermfg = 240, fg = "#50556d" }) | |
hi(0, "Normal", { bg = "#1f2130", ctermbg = 235, ctermfg = 252, fg = "#ccd0d9" }) | |
hi(0, "NormalFloat", { bg = "#171924", ctermbg = 234, ctermfg = 252, fg = "#caced7" }) | |
hi(0, "NormalNC", { bg = "#1f2130", ctermbg = 235, ctermfg = 252, fg = "#ccd0d9" }) | |
hi(0, "NvimTreeGitDeleted", { ctermfg = 168, fg = "#c8506d" }) | |
hi(0, "NvimTreeGitDirty", { ctermfg = 180, fg = "#d8c08a" }) | |
hi(0, "NvimTreeGitNew", { ctermfg = 108, fg = "#81b29a" }) | |
hi(0, "NvimTreeImageFile", { ctermfg = 250, fg = "#bfbebe" }) | |
hi(0, "NvimTreeNormal", { bg = "#1d1f2b", ctermbg = 234, ctermfg = 188, fg = "#d2d5da" }) | |
hi(0, "NvimTreeRootFolder", { bold = true, ctermfg = 251, fg = "#c8c0c8" }) | |
hi(0, "NvimTreeSpecialFile", { ctermfg = 250, fg = "#a5bdcd" }) | |
hi(0, "NvimTreeSymlink", { ctermfg = 140, fg = "#b992d1" }) | |
hi(0, "Operator", { ctermfg = 145, fg = "#aeafb0" }) | |
hi(0, "Pmenu", { bg = "#232d3f", ctermbg = 236, ctermfg = 252, fg = "#caced7" }) | |
hi(0, "PmenuSbar", { bg = "#283242", ctermbg = 236 }) | |
hi(0, "PmenuSel", { bg = "#374d67", ctermbg = 239 }) | |
hi(0, "PmenuThumb", { bg = "#3d4b66", ctermbg = 239 }) | |
hi(0, "PreProc", { ctermfg = 175, fg = "#e48fbf" }) | |
hi(0, "Question", { ctermfg = 104, fg = "#6d9bdf" }) | |
hi(0, "QuickFixLine", { bg = "#303a51", ctermbg = 237 }) | |
hi(0, "Search", { bg = "#3e536e", ctermbg = 239 }) | |
hi(0, "SignColumn", { ctermfg = 244, fg = "#7a809b" }) | |
hi(0, "Special", { ctermfg = 110, fg = "#83b6dc" }) | |
hi(0, "SpecialKey", { ctermfg = 103, fg = "#868faa" }) | |
hi(0, "SpellBad", { sp = "#d25263", undercurl = true }) | |
hi(0, "SpellCap", { sp = "#d4b568", undercurl = true }) | |
hi(0, "SpellLocal", { sp = "#8ab6f1", undercurl = true }) | |
hi(0, "SpellRare", { sp = "#bbbd88", undercurl = true }) | |
hi(0, "Statement", { ctermfg = 140, fg = "#b691e1" }) | |
hi(0, "StatusLine", { bg = "#161925", ctermbg = 234, ctermfg = 249, fg = "#b0b3ba" }) | |
hi(0, "StatusLineNC", { bg = "#171924", ctermbg = 234, ctermfg = 238, fg = "#42475e" }) | |
hi(0, "String", { ctermfg = 150, fg = "#a0cb8d" }) | |
hi(0, "Substitute", { bg = "#ca4f69", ctermbg = 168, ctermfg = 59, fg = "#55606f" }) | |
hi(0, "TabLine", { bg = "#212330", ctermbg = 235, ctermfg = 103, fg = "#8a8ea4" }) | |
hi(0, "TabLineSel", { bg = "#71839b", ctermbg = 67, ctermfg = 235, fg = "#1e2428" }) | |
hi(0, "TelescopeBorder", { ctermfg = 103, fg = "#7c96b6" }) | |
hi(0, "Title", { bold = true, ctermfg = 111, fg = "#7fa9ee" }) | |
hi(0, "Todo", { bg = "#bfbc85", ctermbg = 180, ctermfg = 235, fg = "#202937" }) | |
hi(0, "Type", { ctermfg = 144, fg = "#b9af90" }) | |
hi(0, "Underlined", { underline = true }) | |
hi(0, "VertSplit", { ctermfg = 234, fg = "#171923" }) | |
hi(0, "Visual", { bg = "#2e3f57", ctermbg = 237 }) | |
hi(0, "VisualNOS", { bg = "#2e3f57", ctermbg = 237 }) | |
hi(0, "WarningMsg", { ctermfg = 179, fg = "#d4b568" }) | |
hi(0, "Whitespace", { ctermfg = 238, fg = "#40455c" }) | |
hi(0, "WildMenu", { bg = "#323e55", ctermbg = 237 }) | |
hi(0, "diffAdded", { ctermfg = 108, fg = "#7fb585" }) | |
hi(0, "diffChanged", { ctermfg = 179, fg = "#cbb165" }) | |
hi(0, "diffNewFile", { ctermfg = 173, fg = "#d39668" }) | |
hi(0, "diffOldFile", { ctermfg = 179, fg = "#debf74" }) | |
hi(0, "diffRemoved", { ctermfg = 168, fg = "#c8506d" }) | |
hi(0, "lCursor", { bg = "#ccd0d9", ctermbg = 252, ctermfg = 235, fg = "#1f2130" }) | |
hi(0, "qfFileName", { ctermfg = 111, fg = "#7ba5ea" }) | |
hi(0, "qfLineNr", { ctermfg = 244, fg = "#7c7f99" }) | |
-- Terminal colors | |
local g = vim.g | |
g.terminal_color_0 = "#1f2130" | |
g.terminal_color_1 = "#f1a872" | |
g.terminal_color_2 = "#bfbc85" | |
g.terminal_color_3 = "#d4b568" | |
g.terminal_color_4 = "#ccd0d9" | |
g.terminal_color_5 = "#ccd0d9" | |
g.terminal_color_6 = "#70aed5" | |
g.terminal_color_7 = "#ccd0d9" | |
g.terminal_color_8 = "#1f2130" | |
g.terminal_color_9 = "#f1a872" | |
g.terminal_color_10 = "#bfbc85" | |
g.terminal_color_11 = "#d4b568" | |
g.terminal_color_12 = "#ccd0d9" | |
g.terminal_color_13 = "#ccd0d9" | |
g.terminal_color_14 = "#70aed5" | |
g.terminal_color_15 = "#ccd0d9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Made with 'mini.colors' module of https://github.com/echasnovski/mini.nvim | |
if vim.g.colors_name ~= nil then vim.cmd('highlight clear') end | |
vim.g.colors_name = "average_light" | |
-- Highlight groups | |
local hi = vim.api.nvim_set_hl | |
hi(0, "@constant.builtin", { ctermfg = 67, fg = "#527891" }) | |
hi(0, "@constructor", { ctermfg = 67, fg = "#5187b1" }) | |
hi(0, "@function.builtin", { ctermfg = 67, fg = "#527891" }) | |
hi(0, "@lsp.type.comment", { ctermfg = 102, fg = "#858894" }) | |
hi(0, "@lsp.type.decorator", { ctermfg = 26, fg = "#3960ca" }) | |
hi(0, "@lsp.type.enumMember", { ctermfg = 130, fg = "#b15c00" }) | |
hi(0, "@lsp.type.function", { ctermfg = 26, fg = "#3960ca" }) | |
hi(0, "@lsp.type.parameter", { ctermfg = 60, fg = "#675e72" }) | |
hi(0, "@lsp.type.property", { ctermfg = 25, fg = "#355dbf" }) | |
hi(0, "@lsp.type.type", { ctermfg = 130, fg = "#9c6342" }) | |
hi(0, "@parameter", { ctermfg = 241, fg = "#6b5f69" }) | |
hi(0, "@string.escape", { ctermfg = 131, fg = "#bb5c52" }) | |
hi(0, "@string.regex", { ctermfg = 241, fg = "#725f3a" }) | |
hi(0, "@tag.delimiter", { ctermfg = 30, fg = "#327e92" }) | |
hi(0, "@text.literal", { ctermfg = 30, fg = "#417d7e" }) | |
hi(0, "@text.reference", { ctermfg = 243, fg = "#807671" }) | |
hi(0, "@text.title", { ctermfg = 26, fg = "#2163ce" }) | |
hi(0, "@text.todo", { bg = "#856f3e", ctermbg = 94, ctermfg = 255, fg = "#f1f1f1" }) | |
hi(0, "@text.uri", { underline = true }) | |
hi(0, "@variable", { ctermfg = 240, fg = "#50546e" }) | |
hi(0, "@variable.builtin", { ctermfg = 160, fg = "#c1394d" }) | |
hi(0, "Bold", { bold = true }) | |
hi(0, "Character", { ctermfg = 65, fg = "#4c7655" }) | |
hi(0, "CmpItemAbbrDeprecated", { ctermfg = 102, fg = "#858894", strikethrough = true }) | |
hi(0, "CmpItemAbbrMatch", { ctermfg = 60, fg = "#4d699b" }) | |
hi(0, "CmpItemAbbrMatchFuzzy", { ctermfg = 60, fg = "#4d699b" }) | |
hi(0, "CmpItemKindClass", { ctermfg = 130, fg = "#a5600b" }) | |
hi(0, "CmpItemKindEnum", { ctermfg = 242, fg = "#77713f" }) | |
hi(0, "CmpItemKindFunction", { ctermfg = 26, fg = "#3960ca" }) | |
hi(0, "CmpItemKindInterface", { ctermfg = 95, fg = "#936565" }) | |
hi(0, "CmpItemKindMethod", { ctermfg = 26, fg = "#3960ca" }) | |
hi(0, "CmpItemKindOperator", { ctermfg = 243, fg = "#757074" }) | |
hi(0, "CmpItemKindSnippet", { ctermfg = 60, fg = "#68709a" }) | |
hi(0, "CmpItemKindStruct", { ctermfg = 243, fg = "#5f7975" }) | |
hi(0, "CmpItemKindValue", { ctermfg = 131, fg = "#bf5e4d" }) | |
hi(0, "ColorColumn", { bg = "#d8dade", ctermbg = 253 }) | |
hi(0, "Comment", { ctermfg = 102, fg = "#858894" }) | |
hi(0, "Conceal", { ctermfg = 246, fg = "#8c8fa1" }) | |
hi(0, "Constant", { ctermfg = 130, fg = "#b15c00" }) | |
hi(0, "Cursor", { bg = "#4c4f69", ctermbg = 239, ctermfg = 255, fg = "#f1f1f1" }) | |
hi(0, "CursorIM", { bg = "#4c4f69", ctermbg = 239, ctermfg = 255, fg = "#f1f1f1" }) | |
hi(0, "CursorLine", { bg = "#d3d5db", ctermbg = 188 }) | |
hi(0, "CursorLineNr", { ctermfg = 243, fg = "#767179" }) | |
hi(0, "DashboardCenter", { ctermfg = 65, fg = "#6a8e52" }) | |
hi(0, "DashboardFooter", { ctermfg = 102, fg = "#97847b" }) | |
hi(0, "DashboardHeader", { ctermfg = 62, fg = "#2d6edb" }) | |
hi(0, "DashboardShortCut", { ctermfg = 67, fg = "#6a94b7" }) | |
hi(0, "DiagnosticError", { ctermfg = 160, fg = "#cb2839" }) | |
hi(0, "DiagnosticHint", { ctermfg = 65, fg = "#4a8577" }) | |
hi(0, "DiagnosticInfo", { ctermfg = 31, fg = "#347eba" }) | |
hi(0, "DiagnosticUnderlineError", { sp = "#cb2839" }) | |
hi(0, "DiagnosticUnderlineInfo", { sp = "#347eba" }) | |
hi(0, "DiagnosticUnderlineWarn", { sp = "#cd7f01" }) | |
hi(0, "DiagnosticWarn", { ctermfg = 172, fg = "#cd7f01" }) | |
hi(0, "DiffAdd", { bg = "#c8dac9", ctermbg = 187 }) | |
hi(0, "DiffChange", { bg = "#dadfea", ctermbg = 253 }) | |
hi(0, "DiffDelete", { bg = "#e6cace", ctermbg = 252 }) | |
hi(0, "DiffText", { bg = "#c9d8f5", ctermbg = 189 }) | |
hi(0, "Directory", { ctermfg = 26, fg = "#2465d1" }) | |
hi(0, "EndOfBuffer", { ctermfg = 255, fg = "#f1f1f1" }) | |
hi(0, "Error", { ctermfg = 160, fg = "#cb2839" }) | |
hi(0, "ErrorMsg", { ctermfg = 160, fg = "#cb2839" }) | |
hi(0, "FloatBorder", { ctermfg = 60, fg = "#4b7390" }) | |
hi(0, "FoldColumn", { ctermfg = 245, fg = "#8d8d9c" }) | |
hi(0, "Folded", { bg = "#d1d5e1", ctermbg = 188, ctermfg = 243, fg = "#647291" }) | |
hi(0, "Function", { ctermfg = 26, fg = "#3960ca" }) | |
hi(0, "GitSignsAdd", { ctermfg = 101, fg = "#5a9962" }) | |
hi(0, "GitSignsChange", { ctermfg = 136, fg = "#b67e2f" }) | |
hi(0, "GitSignsDelete", { ctermfg = 167, fg = "#d24349" }) | |
hi(0, "Identifier", { ctermfg = 242, fg = "#5f7282" }) | |
hi(0, "IncSearch", { bg = "#cd8839", ctermbg = 172, ctermfg = 255, fg = "#e9e9e9" }) | |
hi(0, "Italic", { italic = true }) | |
hi(0, "Keyword", { ctermfg = 97, fg = "#844e93" }) | |
hi(0, "LineNr", { ctermfg = 145, fg = "#aeaebb" }) | |
hi(0, "LspReferenceRead", { bg = "#dfd5c5", ctermbg = 188 }) | |
hi(0, "LspReferenceText", { bg = "#dfd5c5", ctermbg = 188 }) | |
hi(0, "LspReferenceWrite", { bg = "#dfd5c5", ctermbg = 188 }) | |
hi(0, "MatchParen", { ctermfg = 130, fg = "#b15c00" }) | |
hi(0, "ModeMsg", { bold = true, ctermfg = 242, fg = "#716e77" }) | |
hi(0, "MoreMsg", { ctermfg = 62, fg = "#2b6cd8" }) | |
hi(0, "NonText", { ctermfg = 247, fg = "#9da0ae" }) | |
hi(0, "Normal", { bg = "#f1f1f1", ctermbg = 255, ctermfg = 239, fg = "#4c4f69" }) | |
hi(0, "NormalFloat", { bg = "#e9e9e9", ctermbg = 255, ctermfg = 238, fg = "#3e456c" }) | |
hi(0, "NormalNC", { bg = "#f1f1f1", ctermbg = 255, ctermfg = 239, fg = "#4c4f69" }) | |
hi(0, "NvimTreeGitDeleted", { ctermfg = 167, fg = "#d24349" }) | |
hi(0, "NvimTreeGitDirty", { ctermfg = 94, fg = "#9a6204" }) | |
hi(0, "NvimTreeGitNew", { ctermfg = 65, fg = "#62936f" }) | |
hi(0, "NvimTreeImageFile", { ctermfg = 243, fg = "#7c756d" }) | |
hi(0, "NvimTreeNormal", { bg = "#e8e9ec", ctermbg = 255, ctermfg = 240, fg = "#50546e" }) | |
hi(0, "NvimTreeRootFolder", { bold = true, ctermfg = 242, fg = "#69717a" }) | |
hi(0, "NvimTreeSpecialFile", { ctermfg = 103, fg = "#8a8da2" }) | |
hi(0, "NvimTreeSymlink", { ctermfg = 97, fg = "#916bbc" }) | |
hi(0, "Operator", { ctermfg = 243, fg = "#6e7088" }) | |
hi(0, "Pmenu", { bg = "#d5d6d9", ctermbg = 188, ctermfg = 238, fg = "#3d456c" }) | |
hi(0, "PmenuSbar", { bg = "#d5d6da", ctermbg = 188 }) | |
hi(0, "PmenuSel", { bg = "#a6bdd1", ctermbg = 250 }) | |
hi(0, "PmenuThumb", { bg = "#b6bac5", ctermbg = 250 }) | |
hi(0, "PreProc", { ctermfg = 133, fg = "#b5459a" }) | |
hi(0, "Question", { ctermfg = 62, fg = "#2b6cd8" }) | |
hi(0, "QuickFixLine", { bg = "#c5c9d5", ctermbg = 251 }) | |
hi(0, "Search", { bg = "#b5cbd2", ctermbg = 251 }) | |
hi(0, "SignColumn", { ctermfg = 145, fg = "#aeaebb" }) | |
hi(0, "Special", { ctermfg = 67, fg = "#4a76a1" }) | |
hi(0, "SpecialKey", { ctermfg = 103, fg = "#8b90ad" }) | |
hi(0, "SpellBad", { sp = "#cb2839", undercurl = true }) | |
hi(0, "SpellCap", { sp = "#cd7f01", undercurl = true }) | |
hi(0, "SpellLocal", { sp = "#467bba", undercurl = true }) | |
hi(0, "SpellRare", { sp = "#747a72", undercurl = true }) | |
hi(0, "Statement", { ctermfg = 98, fg = "#8943e0" }) | |
hi(0, "StatusLine", { bg = "#dcdee0", ctermbg = 253, ctermfg = 239, fg = "#4c4f69" }) | |
hi(0, "StatusLineNC", { bg = "#e9e9e9", ctermbg = 255, ctermfg = 145, fg = "#aeaebb" }) | |
hi(0, "String", { ctermfg = 65, fg = "#58753a" }) | |
hi(0, "Substitute", { bg = "#d54852", ctermbg = 167, ctermfg = 243, fg = "#727175" }) | |
hi(0, "TabLine", { bg = "#e8e9ec", ctermbg = 255, ctermfg = 243, fg = "#6c7188" }) | |
hi(0, "TabLineSel", { bg = "#78858e", ctermbg = 244, ctermfg = 255, fg = "#eae9ec" }) | |
hi(0, "TelescopeBorder", { ctermfg = 67, fg = "#517997" }) | |
hi(0, "Title", { bold = true, ctermfg = 26, fg = "#2163ce" }) | |
hi(0, "Todo", { bg = "#856f3e", ctermbg = 94, ctermfg = 255, fg = "#f1f1f1" }) | |
hi(0, "Type", { ctermfg = 130, fg = "#9c6342" }) | |
hi(0, "Underlined", { underline = true }) | |
hi(0, "VertSplit", { ctermfg = 254, fg = "#dee0e3" }) | |
hi(0, "Visual", { bg = "#c7cbd7", ctermbg = 252 }) | |
hi(0, "VisualNOS", { bg = "#c7cbd7", ctermbg = 252 }) | |
hi(0, "WarningMsg", { ctermfg = 172, fg = "#cd7f01" }) | |
hi(0, "Whitespace", { ctermfg = 250, fg = "#bfbfcc" }) | |
hi(0, "WildMenu", { bg = "#d1d3e0", ctermbg = 188 }) | |
hi(0, "diffAdded", { ctermfg = 101, fg = "#64945f" }) | |
hi(0, "diffChanged", { ctermfg = 94, fg = "#906f0f" }) | |
hi(0, "diffNewFile", { ctermfg = 130, fg = "#b87420" }) | |
hi(0, "diffOldFile", { ctermfg = 130, fg = "#b46e22" }) | |
hi(0, "diffRemoved", { ctermfg = 160, fg = "#c5353c" }) | |
hi(0, "lCursor", { bg = "#4c4f69", ctermbg = 239, ctermfg = 255, fg = "#f1f1f1" }) | |
hi(0, "qfFileName", { ctermfg = 26, fg = "#2465d1" }) | |
hi(0, "qfLineNr", { ctermfg = 244, fg = "#9a6f79" }) | |
-- Terminal colors | |
local g = vim.g | |
g.terminal_color_0 = "#f1f1f1" | |
g.terminal_color_1 = "#cb2839" | |
g.terminal_color_2 = "#856f3e" | |
g.terminal_color_3 = "#856f3e" | |
g.terminal_color_4 = "#4c4f69" | |
g.terminal_color_5 = "#4c4f69" | |
g.terminal_color_6 = "#527891" | |
g.terminal_color_7 = "#4c4f69" | |
g.terminal_color_8 = "#f1f1f1" | |
g.terminal_color_9 = "#cb2839" | |
g.terminal_color_10 = "#856f3e" | |
g.terminal_color_11 = "#856f3e" | |
g.terminal_color_12 = "#4c4f69" | |
g.terminal_color_13 = "#4c4f69" | |
g.terminal_color_14 = "#527891" | |
g.terminal_color_15 = "#4c4f69" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- "Average" color schemes | |
-- | |
-- This script will load color schemes supplied in "Hyperparameters", | |
-- compute average color scheme (compute median attribute value of highlight | |
-- groups present in all color schemes) and save it under configurable name in | |
-- configurable directory. | |
-- | |
-- Dependencies (ideally only these plugins should be loaded): | |
-- - https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-colors.md | |
-- (for color scheme manipulations) | |
-- | |
-- - Reference color scheme plugins. | |
-- Supplied lists contain top 5 popular Lua Neovim color schemes. This is how | |
-- they were chosen: | |
-- - Go through https://github.com/rockerBOO/awesome-neovim. | |
-- - Pick top 5 Lua implemented color schemes with most stars which are | |
-- not repeating. | |
-- | |
-- Final list (as of 2023-04-20): | |
-- | Color scheme | Stargazers | | |
-- |-----------------------------|------------| | |
-- | folke/tokyonight.nvim | 3476 stars | | |
-- | catppuccin/nvim | 2639 stars | | |
-- | rebelot/kanagawa.nvim | 2219 stars | | |
-- | EdenEast/nightfox.nvim | 2055 stars | | |
-- | projekt0n/github-nvim-theme | 1379 stars | | |
-- | |
-- Notes: | |
-- - Original list was made also accounting for Vimscript color schemes | |
-- with Neovim relevant highlight groups. | |
-- This included 'sainnhe/everforest' (1815 stars) as the fifth color scheme. | |
-- Although it is sooooooo nice, it is quite different in terms of which | |
-- attributes it defines for certain highlight groups. Including it instead | |
-- of 'projekt0n/github-nvim-theme' resulted in not very coherent output. | |
-- So in the end it was decided to take "top 5 **Lua** color schemes". | |
-- | |
-- - Due to averaging colors using Oklab color space, sever disagreement on | |
-- some color attribute leads to its deasaturation (becoming more gray) | |
local colors = require('mini.colors') | |
-- Hyperparameters ------------------------------------------------------------ | |
-- Color scheme names to average | |
local cs_names = { | |
-- Use the default variants of supplied color schemes. | |
'tokyonight', | |
'catppuccin', | |
'kanagawa', | |
'nightfox', | |
'github_dark', | |
} | |
-- Output color scheme name | |
local output_name = 'average_dark' | |
-- -- Light variants of top color schemes to average: | |
-- local cs_names = { | |
-- 'tokyonight-day', | |
-- 'catppuccin-latte', | |
-- 'kanagawa-lotus', | |
-- 'dayfox', | |
-- 'github_light', | |
-- } | |
-- | |
-- -- Output color scheme name | |
-- local output_name = 'average_light' | |
-- Output directory | |
local output_directory = vim.fn.stdpath('config') .. '/colors' | |
-- Compute average color scheme =============================================== | |
-- Threshold number used to decide whether to include highlight group and | |
-- attributes in the output. Decrease this number will increase number of | |
-- highlight groups at cost of also increasing number of unique colors | |
-- sacrificing integrity of output. | |
-- Other possible values: | |
-- local n_threshold = 0 | |
-- local n_threshold = math.floor(0.5 * #cs_names + 0.5) | |
local n_threshold = #cs_names | |
local extract = function(arr, field) | |
local res = {} | |
-- NOTE: use `pairs` instead of `ipairs` because there might be | |
-- non-consecutive fields | |
for _, v in pairs(arr) do | |
if type(v) == 'table' and v[field] ~= nil then table.insert(res, v[field]) end | |
end | |
return res | |
end | |
local should_ignore = function(arr) | |
-- Average only if operands are present with at least threshold number amount | |
local n = vim.tbl_count(arr) | |
return n == 0 or n < n_threshold | |
end | |
local median_numeric = function(arr) | |
local t, n = vim.deepcopy(arr), #arr | |
table.sort(t) | |
-- Distinguish between even and odd sample size | |
if n % 2 == 0 then | |
return 0.5 * (t[0.5 * n] + t[0.5 * n + 1]) | |
else | |
return t[0.5 * (n + 1)] | |
end | |
end | |
local median_hex = function(hex_tbl) | |
if should_ignore(hex_tbl) then return nil end | |
local lab_tbl = vim.tbl_map(function(x) return colors.convert(x, 'oklab') end, hex_tbl) | |
local lab_res = { | |
l = median_numeric(extract(lab_tbl, 'l')), | |
a = median_numeric(extract(lab_tbl, 'a')), | |
b = median_numeric(extract(lab_tbl, 'b')), | |
} | |
-- Using `gamut_clip = 'cusp'` makes better lightness/chroma balance | |
return colors.convert(lab_res, 'hex', { gamut_clip = 'cusp' }) | |
end | |
local median_boolean = function(bool_tbl) | |
if should_ignore(bool_tbl) then return nil end | |
local n_true = 0 | |
for _, v in pairs(bool_tbl) do | |
if v == true then n_true = n_true + 1 end | |
end | |
-- Attribute is true if present in all reference color schemes | |
-- Otherwise return `nil` to not explicitly include boolean attribute | |
if n_threshold <= n_true then return true end | |
return nil | |
end | |
--stylua: ignore | |
local median_hl_group = function(gr_tbl) | |
if should_ignore(gr_tbl) then return nil end | |
local res = { | |
fg = median_hex(extract(gr_tbl, 'fg')), | |
bg = median_hex(extract(gr_tbl, 'bg')), | |
sp = median_hex(extract(gr_tbl, 'sp')), | |
bold = median_boolean(extract(gr_tbl, 'bold')), | |
italic = median_boolean(extract(gr_tbl, 'italic')), | |
nocombine = median_boolean(extract(gr_tbl, 'nocombine')), | |
reverse = median_boolean(extract(gr_tbl, 'reverse')), | |
standout = median_boolean(extract(gr_tbl, 'standout')), | |
strikethrough = median_boolean(extract(gr_tbl, 'strikethrough')), | |
undercurl = median_boolean(extract(gr_tbl, 'undercurl')), | |
underdashed = median_boolean(extract(gr_tbl, 'underdashed')), | |
underdotted = median_boolean(extract(gr_tbl, 'underdotted')), | |
underdouble = median_boolean(extract(gr_tbl, 'underdouble')), | |
underline = median_boolean(extract(gr_tbl, 'underline')), | |
} | |
-- Don't clear highlight group | |
if vim.tbl_count(res) == 0 then return nil end | |
return res | |
end | |
local union = function(arr_arr) | |
local value_is_present = {} | |
for _, arr in pairs(arr_arr) do | |
for _, x in pairs(arr) do | |
value_is_present[x] = true | |
end | |
end | |
return vim.tbl_keys(value_is_present) | |
end | |
local average_colorschemes = function(cs_arr) | |
local groups = extract(cs_arr, 'groups') | |
local all_group_names = union(vim.tbl_map(vim.tbl_keys, groups)) | |
local res_groups = {} | |
for _, hl_name in pairs(all_group_names) do | |
res_groups[hl_name] = median_hl_group(extract(groups, hl_name)) | |
end | |
return colors.as_colorscheme({ name = output_name, groups = res_groups }):add_cterm_attributes():add_terminal_colors() | |
end | |
-- Compute and save average color scheme ====================================== | |
local cs_array = vim.tbl_map( | |
function(name) return colors.get_colorscheme(name):compress():resolve_links() end, | |
cs_names | |
) | |
local average_cs = average_colorschemes(cs_array) | |
average_cs:write({ name = output_name, directory = output_directory }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment