diff --git a/lua/astronomy/config.lua b/lua/astronomy/config.lua index 64896d4..dd0937a 100644 --- a/lua/astronomy/config.lua +++ b/lua/astronomy/config.lua @@ -8,37 +8,37 @@ local M = {} -- Default scheme options M.scheme_options = { - variant = "blackhole", - disable = { - background = false, - endOfBuffer = true, - }, - custom_colors = {} + variant = "blackhole", + disable = { + background = false, + endOfBuffer = true, + }, + custom_colors = {} } -- Set custom options to the editor --@param opts table: custom options for editor function M.set_options(opts) - local options = opts or {} - if type(options) == "table" then - local new_sets = vim.tbl_deep_extend( - "force", {}, M.scheme_options, options - ) - M.scheme_options = new_sets - end + local options = opts or {} + if type(options) == "table" then + local new_sets = vim.tbl_deep_extend( + "force", {}, M.scheme_options, options + ) + M.scheme_options = new_sets + end end -- Get the value of secheme options --@param tab table: custom options to be applied to the editor scheme --@returns settings table: settings adapted to load the scheme function M.get_options() - local settings = {} - local opts = M.scheme_options + local settings = {} + local opts = M.scheme_options - settings.eof = opts.disable.endOfBuffer - settings.disable_bg = opts.disable.background and "NONE" + settings.eof = opts.disable.endOfBuffer + settings.disable_bg = opts.disable.background and "NONE" - return settings + return settings end return M diff --git a/lua/astronomy/functions.lua b/lua/astronomy/functions.lua index e3723d4..56537cf 100644 --- a/lua/astronomy/functions.lua +++ b/lua/astronomy/functions.lua @@ -14,32 +14,32 @@ local g = vim.g --@parma pos number: a position to search in the table of variants --@return position number: a valid position for setting a variant from the variant table local function change_variant(v_tab, pos) - if next(v_tab) == nil then return end - return table.getn(v_tab) > pos and pos + 1 or 1 + if next(v_tab) == nil then return end + return #v_tab > pos and pos + 1 or 1 end ---Set a especific variant --@param scheme string: name of the variant to be set function M.set_variant(scheme) - local variant = scheme or "" - utils.setup_scheme { variant = variant } + local variant = scheme or "" + utils.setup_scheme { variant = variant } end --- Sets a variant in accordance with a valid position in the variants table --@param position number: position to load a variant from the variant table local function load_variant(position) - local variant = variants[position] - g.astronomy_variant_loaded = position - M.set_variant(variant) - vim.api.nvim_command(string.format("echo \"[astronomy] colorscheme changed to '%s'\"", variant)) + local variant = variants[position] + g.astronomy_variant_loaded = position + M.set_variant(variant) + vim.api.nvim_command(string.format("echo \"[astronomy] colorscheme changed to '%s'\"", variant)) end --- Set a variant by scrolling through the variant table in an orderly fashion function M.toggle_variant() - local position = change_variant( - variants, g.astronomy_variant_loaded - ) - load_variant(position) + local position = change_variant( + variants, g.astronomy_variant_loaded + ) + load_variant(position) end return M diff --git a/lua/astronomy/init.lua b/lua/astronomy/init.lua index c52ea5b..e145471 100644 --- a/lua/astronomy/init.lua +++ b/lua/astronomy/init.lua @@ -12,11 +12,11 @@ local M = {} -- Setup function to load the colorscheme --@param opts table: custom options to be applied to the editor function M.setup(opts) - utils.setup_scheme(opts) + utils.setup_scheme(opts) end -M.toggle_variant = functions.toggle_variant -M.random_variant = functions.random_variant -M.set_variant = functions.set_variant +M.toggle_variant = functions.toggle_variant +M.random_variant = functions.random_variant +M.set_variant = functions.set_variant return M diff --git a/lua/astronomy/scheme.lua b/lua/astronomy/scheme.lua index 7141464..ed9ad93 100644 --- a/lua/astronomy/scheme.lua +++ b/lua/astronomy/scheme.lua @@ -9,29 +9,29 @@ local M = {} local g = vim.g local static = { - coq_checked ="#36704f", - coq_sent ="#4b4b4b", + coq_checked ="#36704f", + coq_sent ="#4b4b4b", } -- Load terminal colors --@param tab table: scheme colors to apply local function terminal_colors(tab) - g.terminal_color_0 = tab.black - g.terminal_color_1 = tab.darkred - g.terminal_color_2 = tab.darkgreen - g.terminal_color_3 = tab.orange - g.terminal_color_4 = tab.darkblue - g.terminal_color_5 = tab.darkmagenta - g.terminal_color_6 = tab.darkcyan - g.terminal_color_7 = tab.grey - g.terminal_color_8 = tab.darkgrey - g.terminal_color_9 = tab.red - g.terminal_color_10 = tab.green - g.terminal_color_11 = tab.yellow - g.terminal_color_12 = tab.blue - g.terminal_color_13 = tab.magenta - g.terminal_color_14 = tab.cyan - g.terminal_color_15 = tab.white + g.terminal_color_0 = tab.black + g.terminal_color_1 = tab.darkred + g.terminal_color_2 = tab.darkgreen + g.terminal_color_3 = tab.orange + g.terminal_color_4 = tab.darkblue + g.terminal_color_5 = tab.darkmagenta + g.terminal_color_6 = tab.darkcyan + g.terminal_color_7 = tab.grey + g.terminal_color_8 = tab.darkgrey + g.terminal_color_9 = tab.red + g.terminal_color_10 = tab.green + g.terminal_color_11 = tab.yellow + g.terminal_color_12 = tab.blue + g.terminal_color_13 = tab.magenta + g.terminal_color_14 = tab.cyan + g.terminal_color_15 = tab.white end -- load colorscheme elements @@ -39,197 +39,197 @@ end --@param settings table: custom options to be applied to the scheme --@return colors table: all groups and its respectives colors function M.load_colors(scheme) - -- local opts = config.get_options() + -- local opts = config.get_options() - local colors = { - --------------------- - -- EDITOR COLORS -- - --------------------- - Normal = { fg = scheme.foreground, bg = scheme.background, scheme.none }, - NormalFloat = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, - Terminal = { link = "Normal" }, - Visual = { fg = scheme.yellow, bg = scheme.background_alt, scheme.none }, - VisualNOS = { link = "Visual" }, - Cursor = { fg = scheme.background, bg = scheme.foreground, scheme.none }, - CursorLine = { fg = scheme.none, bg = scheme.background_alt, scheme.none }, - CursorColumn = { link = "CursorLine" }, - CursorLineNr = { fg = scheme.orange, bg = scheme.none, scheme.none }, - LineNr = { fg = scheme.grey, bg = scheme.none, scheme.none }, - VertSplit = { fg = scheme.grey, bg = scheme.none, scheme.none }, - SignColumn = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - Folded = { fg = scheme.orange, bg = scheme.background_alt, scheme.none }, + local colors = { + --------------------- + -- EDITOR COLORS -- + --------------------- + Normal = { fg = scheme.foreground, bg = scheme.background, scheme.none }, + NormalFloat = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, + Terminal = { link = "Normal" }, + Visual = { fg = scheme.yellow, bg = scheme.background_alt, scheme.none }, + VisualNOS = { link = "Visual" }, + Cursor = { fg = scheme.background, bg = scheme.foreground, scheme.none }, + CursorLine = { fg = scheme.none, bg = scheme.background_alt, scheme.none }, + CursorColumn = { link = "CursorLine" }, + CursorLineNr = { fg = scheme.orange, bg = scheme.none, scheme.none }, + LineNr = { fg = scheme.grey, bg = scheme.none, scheme.none }, + VertSplit = { fg = scheme.grey, bg = scheme.none, scheme.none }, + SignColumn = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + Folded = { fg = scheme.orange, bg = scheme.background_alt, scheme.none }, - --------------------- - ---- STATUSLINE ----- - --------------------- - StatusLine = { fg = scheme.none, bg = scheme.background, scheme.none }, - StatusLineTerm = { fg = scheme.none, bg = scheme.green, scheme.none }, - StatusLineNF = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, - StatusLineNC = { fg = scheme.none, bg = scheme.none, scheme.none }, - Top = { fg = scheme.background, bg = scheme.foreground_alt, scheme.none }, - Middle = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, - Bottom = { fg = scheme.darkcyan, bg = scheme.background, scheme.none }, - NormalMode = { fg = scheme.black, bg = scheme.green, style = "bold" }, - VisualMode = { fg = scheme.black, bg = scheme.magenta, style = "bold" }, - InsertMode = { fg = scheme.black, bg = scheme.cyan, style = "bold" }, - ReplaceMode = { fg = scheme.black, bg = scheme.orange, style = "bold" }, - CommandMode = { fg = scheme.black, bg = scheme.yellow, style = "bold" }, + --------------------- + ---- STATUSLINE ----- + --------------------- + StatusLine = { fg = scheme.none, bg = scheme.background, scheme.none }, + StatusLineTerm = { fg = scheme.none, bg = scheme.green, scheme.none }, + StatusLineNF = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, + StatusLineNC = { fg = scheme.none, bg = scheme.none, scheme.none }, + Top = { fg = scheme.background, bg = scheme.foreground_alt, scheme.none }, + Middle = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, + Bottom = { fg = scheme.darkcyan, bg = scheme.background, scheme.none }, + NormalMode = { fg = scheme.black, bg = scheme.green, style = "bold" }, + VisualMode = { fg = scheme.black, bg = scheme.magenta, style = "bold" }, + InsertMode = { fg = scheme.black, bg = scheme.cyan, style = "bold" }, + ReplaceMode = { fg = scheme.black, bg = scheme.orange, style = "bold" }, + CommandMode = { fg = scheme.black, bg = scheme.yellow, style = "bold" }, - --------------------- - ----- MESSAGES ------ - --------------------- - Title = { fg = scheme.orange, bg = scheme.none, style = "bold" }, - ErrorMsg = { fg = scheme.yellow, bg = scheme.darkred, style = "bold" }, - ModeMsg = { fg = scheme.none, bg = scheme.none, style = "bold" }, - MoreMsg = { fg = scheme.green, bg = scheme.none, style = "bold" }, - WarningMsg = { fg = scheme.red, bg = scheme.none, style = "bold" }, + --------------------- + ----- MESSAGES ------ + --------------------- + Title = { fg = scheme.orange, bg = scheme.none, style = "bold" }, + ErrorMsg = { fg = scheme.yellow, bg = scheme.darkred, style = "bold" }, + ModeMsg = { fg = scheme.none, bg = scheme.none, style = "bold" }, + MoreMsg = { fg = scheme.green, bg = scheme.none, style = "bold" }, + WarningMsg = { fg = scheme.red, bg = scheme.none, style = "bold" }, - --------------------- - ------- MENUS ------- - --------------------- - Pmenu = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, - PmenuSel = { fg = scheme.background, bg = scheme.darkgreen, style = "bold" }, - PmenuSbar = { fg = scheme.none, bg = scheme.background_alt, scheme.none }, - PmenuThumb = { link = "PmenuSbar" }, - WildMenu = { link = "PmenuSel" }, + --------------------- + ------- MENUS ------- + --------------------- + Pmenu = { fg = scheme.foreground, bg = scheme.background_alt, scheme.none }, + PmenuSel = { fg = scheme.background, bg = scheme.darkgreen, style = "bold" }, + PmenuSbar = { fg = scheme.none, bg = scheme.background_alt, scheme.none }, + PmenuThumb = { link = "PmenuSbar" }, + WildMenu = { link = "PmenuSel" }, - --------------------- - ------- MENUS ------- - --------------------- - Conceal = { fg = scheme.grey, bg = scheme.background_alt, scheme.none }, - Directory = { fg = scheme.magenta, bg = scheme.none, style = "bold" }, - NonText = { fg = scheme.blue, bg = scheme.none, scheme.none }, - EndOfBuffer = { link = "Nontext" }, - Question = { fg = scheme.green, bg = scheme.none, style = "bold" }, - Search = { fg = scheme.background, bg = scheme.grey, scheme.none }, - QuickFixLine = { link = "Search" }, - IncSearch = { fg = scheme.none, bg = scheme.none, style = "reverse" }, - SpecialKey = { fg = scheme.green, bg = scheme.none, scheme.none }, + --------------------- + ------- MENUS ------- + --------------------- + Conceal = { fg = scheme.grey, bg = scheme.background_alt, scheme.none }, + Directory = { fg = scheme.magenta, bg = scheme.none, style = "bold" }, + NonText = { fg = scheme.blue, bg = scheme.none, scheme.none }, + EndOfBuffer = { link = "Nontext" }, + Question = { fg = scheme.green, bg = scheme.none, style = "bold" }, + Search = { fg = scheme.background, bg = scheme.grey, scheme.none }, + QuickFixLine = { link = "Search" }, + IncSearch = { fg = scheme.none, bg = scheme.none, style = "reverse" }, + SpecialKey = { fg = scheme.green, bg = scheme.none, scheme.none }, - --------------------- - ---- IDENTFIERS ----- - --------------------- - MatchParen = { fg = scheme.background, bg = scheme.blue, style = "bold" }, - Comment = { fg = scheme.grey, bg = scheme.none, scheme.none }, - Ignore = { link = "Comment" }, - Whitespace = { link = "Comment" }, - Constant = { fg = scheme.green, bg = scheme.none, scheme.none }, - Boolean = { link = "Constant" }, - Character = { link = "Constant" }, - Number = { link = "Constant" }, - Float = { link = "Constant" }, - String = { link = "Constant" }, - Error = { link = "ErrorMsg" }, - Identifier = { fg = scheme.blue, bg = scheme.none, style = "bold" }, - Function = { link = "Identifier" }, - PreProc = { fg = scheme.red, bg = scheme.none, scheme.none }, - Define = { link = "PreProc" }, - Include = { link = "PreProc" }, - Macro = { link = "PreProc" }, - PreCondit = { link = "PreProc" }, - Special = { fg = scheme.orange, bg = scheme.none, scheme.none }, - SpecialChar = { link = "Special" }, - SpecialComment = { link = "Special" }, - Debug = { link = "Special" }, - Delimiter = { link = "Special" }, - Tag = { link = "Special" }, - Statement = { fg = scheme.magenta, bg = scheme.none, scheme.none }, - Conditional = { link = "Statement" }, - Exception = { link = "Statement" }, - Keyword = { link = "Statement" }, - Label = { link = "Statement" }, - Operator = { link = "Statement" }, - Repeat = { link = "Statement" }, - Todo = { fg = scheme.black, bg = scheme.yellow, style = "bold" }, - Type = { fg = scheme.yellow, bg = scheme.none, style = "bold" }, - StorageClass = { link = "Type" }, - Structure = { link = "Type" }, - Typedef = { link = "Type" }, - Underlined = { fg = scheme.darkblue, bg = scheme.none, style = "underline" }, + --------------------- + ---- IDENTFIERS ----- + --------------------- + MatchParen = { fg = scheme.background, bg = scheme.blue, style = "bold" }, + Comment = { fg = scheme.grey, bg = scheme.none, scheme.none }, + Ignore = { link = "Comment" }, + Whitespace = { link = "Comment" }, + Constant = { fg = scheme.green, bg = scheme.none, scheme.none }, + Boolean = { link = "Constant" }, + Character = { link = "Constant" }, + Number = { link = "Constant" }, + Float = { link = "Constant" }, + String = { link = "Constant" }, + Error = { link = "ErrorMsg" }, + Identifier = { fg = scheme.blue, bg = scheme.none, style = "bold" }, + Function = { link = "Identifier" }, + PreProc = { fg = scheme.red, bg = scheme.none, scheme.none }, + Define = { link = "PreProc" }, + Include = { link = "PreProc" }, + Macro = { link = "PreProc" }, + PreCondit = { link = "PreProc" }, + Special = { fg = scheme.orange, bg = scheme.none, scheme.none }, + SpecialChar = { link = "Special" }, + SpecialComment = { link = "Special" }, + Debug = { link = "Special" }, + Delimiter = { link = "Special" }, + Tag = { link = "Special" }, + Statement = { fg = scheme.magenta, bg = scheme.none, scheme.none }, + Conditional = { link = "Statement" }, + Exception = { link = "Statement" }, + Keyword = { link = "Statement" }, + Label = { link = "Statement" }, + Operator = { link = "Statement" }, + Repeat = { link = "Statement" }, + Todo = { fg = scheme.black, bg = scheme.yellow, style = "bold" }, + Type = { fg = scheme.yellow, bg = scheme.none, style = "bold" }, + StorageClass = { link = "Type" }, + Structure = { link = "Type" }, + Typedef = { link = "Type" }, + Underlined = { fg = scheme.darkblue, bg = scheme.none, style = "underline" }, - --------------------- - -- LANGUAGE COLORS -- - --------------------- - --------- - -- GIT -- - --------- - signifySignAdd = { fg = scheme.green, bg = scheme.none, scheme.none }, - signifySignChange = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - signifySignDelete = { fg = scheme.red, bg = scheme.none, scheme.none }, - gitcommitComment = { fg = scheme.grey, bg = scheme.none, scheme.none }, - gitcommitDiscardedType = { fg = scheme.red, bg = scheme.none, scheme.none }, - gitcommitSelectedType = { fg = scheme.green, bg = scheme.none, scheme.none }, - gitcommitHeader = { fg = scheme.none, bg = scheme.none, scheme.none }, - gitcommitUntrackedFile = { fg = scheme.cyan, bg = scheme.none, scheme.none }, - gitcommitDiscardedFile = { fg = scheme.red, bg = scheme.none, scheme.none }, - gitcommitSelectedFile = { fg = scheme.green, bg = scheme.none, scheme.none }, - gitcommitUnmergedFile = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - gitcommitUnmerged = { fg = scheme.green, bg = scheme.none, scheme.none }, - gitcommitOnBranch = { fg = scheme.none, bg = scheme.none, scheme.none }, - gitcommitBranch = { fg = scheme.magenta, bg = scheme.none, scheme.none }, + --------------------- + -- LANGUAGE COLORS -- + --------------------- + --------- + -- GIT -- + --------- + signifySignAdd = { fg = scheme.green, bg = scheme.none, scheme.none }, + signifySignChange = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + signifySignDelete = { fg = scheme.red, bg = scheme.none, scheme.none }, + gitcommitComment = { fg = scheme.grey, bg = scheme.none, scheme.none }, + gitcommitDiscardedType = { fg = scheme.red, bg = scheme.none, scheme.none }, + gitcommitSelectedType = { fg = scheme.green, bg = scheme.none, scheme.none }, + gitcommitHeader = { fg = scheme.none, bg = scheme.none, scheme.none }, + gitcommitUntrackedFile = { fg = scheme.cyan, bg = scheme.none, scheme.none }, + gitcommitDiscardedFile = { fg = scheme.red, bg = scheme.none, scheme.none }, + gitcommitSelectedFile = { fg = scheme.green, bg = scheme.none, scheme.none }, + gitcommitUnmergedFile = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + gitcommitUnmerged = { fg = scheme.green, bg = scheme.none, scheme.none }, + gitcommitOnBranch = { fg = scheme.none, bg = scheme.none, scheme.none }, + gitcommitBranch = { fg = scheme.magenta, bg = scheme.none, scheme.none }, - ---------- - -- diff -- - ---------- - diffAdded = { fg = scheme.green, bg = scheme.none, scheme.none }, - diffFile = { fg = scheme.orange, bg = scheme.none, scheme.none }, - diffNewFile = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - diffChanged = { fg = scheme.cyan, bg = scheme.none, scheme.none }, - diffRemoved = { fg = scheme.red, bg = scheme.none, scheme.none }, - diffLine = { fg = scheme.blue, bg = scheme.none, scheme.none }, + ---------- + -- diff -- + ---------- + diffAdded = { fg = scheme.green, bg = scheme.none, scheme.none }, + diffFile = { fg = scheme.orange, bg = scheme.none, scheme.none }, + diffNewFile = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + diffChanged = { fg = scheme.cyan, bg = scheme.none, scheme.none }, + diffRemoved = { fg = scheme.red, bg = scheme.none, scheme.none }, + diffLine = { fg = scheme.blue, bg = scheme.none, scheme.none }, - ---------------- - -- LSP COLORS -- - ---------------- - DiagnosticVirtualTextWarn = { fg = scheme.orange, bg = scheme.none, scheme.none }, - DiagnosticUnderlineWarn = { fg = scheme.orange, bg = scheme.none, style = "underline" }, - DiagnosticFloatingWarn = { link = "DiagnosticVirtualTextWarn" }, - DiagnosticSignWarn = { link = "DiagnosticVirtualTextWarn" }, + ---------------- + -- LSP COLORS -- + ---------------- + DiagnosticVirtualTextWarn = { fg = scheme.orange, bg = scheme.none, scheme.none }, + DiagnosticUnderlineWarn = { fg = scheme.orange, bg = scheme.none, style = "underline" }, + DiagnosticFloatingWarn = { link = "DiagnosticVirtualTextWarn" }, + DiagnosticSignWarn = { link = "DiagnosticVirtualTextWarn" }, - DiagnosticVirtualTextError = { fg = scheme.red, bg = scheme.none, scheme.none }, - DiagnosticUnderlineError = { fg = scheme.red, bg = scheme.none, style = "underline" }, - DiagnosticFloatingError = { link = "DiagnosticVirtualTextError" }, - DiagnosticSignError = { link = "DiagnosticVirtualTextError" }, + DiagnosticVirtualTextError = { fg = scheme.red, bg = scheme.none, scheme.none }, + DiagnosticUnderlineError = { fg = scheme.red, bg = scheme.none, style = "underline" }, + DiagnosticFloatingError = { link = "DiagnosticVirtualTextError" }, + DiagnosticSignError = { link = "DiagnosticVirtualTextError" }, - DiagnosticVirtualTextInfo = { fg = scheme.blue, bg = scheme.none, scheme.none }, - DiagnosticUnderlineInfo = { fg = scheme.blue, bg = scheme.none, style = "underline" }, - DiagnosticFloatingInfo = { link = "DiagnosticVirtualTextInfo" }, - DiagnosticSignInfo = { link = "DiagnosticVirtualTextInfo" }, + DiagnosticVirtualTextInfo = { fg = scheme.blue, bg = scheme.none, scheme.none }, + DiagnosticUnderlineInfo = { fg = scheme.blue, bg = scheme.none, style = "underline" }, + DiagnosticFloatingInfo = { link = "DiagnosticVirtualTextInfo" }, + DiagnosticSignInfo = { link = "DiagnosticVirtualTextInfo" }, - DiagnosticVirtualTextHint = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - DiagnosticUnderlineHint = { fg = scheme.yellow, bg = scheme.none, style = "underline" }, - DiagnosticFloatingHint = { link = "DiagnosticVirtualTextHint" }, - DiagnosticSignHint = { link = "DiagnosticVirtualTextHint" }, + DiagnosticVirtualTextHint = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + DiagnosticUnderlineHint = { fg = scheme.yellow, bg = scheme.none, style = "underline" }, + DiagnosticFloatingHint = { link = "DiagnosticVirtualTextHint" }, + DiagnosticSignHint = { link = "DiagnosticVirtualTextHint" }, - -------------------- - -- LUASNIP COLORS -- - -------------------- - LuaSnipInactive = { link = "Comment" }, - LuaSnipChoice = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - LuaSnipFunction = { fg = scheme.magenta, bg = scheme.none, scheme.none }, - LuaSnipInsert = { fg = scheme.blue, bg = scheme.none, scheme.none }, + -------------------- + -- LUASNIP COLORS -- + -------------------- + LuaSnipInactive = { link = "Comment" }, + LuaSnipChoice = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + LuaSnipFunction = { fg = scheme.magenta, bg = scheme.none, scheme.none }, + LuaSnipInsert = { fg = scheme.blue, bg = scheme.none, scheme.none }, - ---------------- - -- CMP COLORS -- - ---------------- - CmpItemKindVariable = { fg = scheme.none, bg = scheme.none, scheme.none }, - CmpItemKindClass = { fg = scheme.yellow, bg = scheme.none, scheme.none }, - CmpItemKindInterface = { link = "CmpItemKindClass" }, - CmpItemKindModule = { link = "CmpItemKindClass" }, - CmpItemKindText = { fg = scheme.green, bg = scheme.none, scheme.none }, - CmpItemKindKeyword = { fg = scheme.orange, bg = scheme.none, scheme.none }, - CmpItemKindFunction = { fg = scheme.blue, bg = scheme.none, scheme.none }, - CmpItemKindMethod = { link = "CmpItemKindFunction" }, + ---------------- + -- CMP COLORS -- + ---------------- + CmpItemKindVariable = { fg = scheme.none, bg = scheme.none, scheme.none }, + CmpItemKindClass = { fg = scheme.yellow, bg = scheme.none, scheme.none }, + CmpItemKindInterface = { link = "CmpItemKindClass" }, + CmpItemKindModule = { link = "CmpItemKindClass" }, + CmpItemKindText = { fg = scheme.green, bg = scheme.none, scheme.none }, + CmpItemKindKeyword = { fg = scheme.orange, bg = scheme.none, scheme.none }, + CmpItemKindFunction = { fg = scheme.blue, bg = scheme.none, scheme.none }, + CmpItemKindMethod = { link = "CmpItemKindFunction" }, - ---------------- - -- COQ COLORS -- - ---------------- - CoqtailChecked = { fg = scheme.none, bg = static.coq_checked, scheme.none }, - CoqtailSent = { fg = scheme.none, bg = static.coq_sent, scheme.none }, - } + ---------------- + -- COQ COLORS -- + ---------------- + CoqtailChecked = { fg = scheme.none, bg = static.coq_checked, scheme.none }, + CoqtailSent = { fg = scheme.none, bg = static.coq_sent, scheme.none }, + } - terminal_colors(scheme) - return colors + terminal_colors(scheme) + return colors end return M diff --git a/lua/astronomy/utils.lua b/lua/astronomy/utils.lua index 5e2c8d7..e03307d 100644 --- a/lua/astronomy/utils.lua +++ b/lua/astronomy/utils.lua @@ -15,56 +15,55 @@ local M = {} --@param group string: group name --@param cols string: color name to be applied to the groups local function set_highlights(group, cols) - api.nvim_command(string.format('highlight %s gui=%s guifg=%s guibg=%s guisp=%s', - group, - cols.style or "NONE", - cols.fg or "NONE", - cols.bg or "NONE", - cols.sp or "NONE" - )) + api.nvim_command(string.format('highlight %s gui=%s guifg=%s guibg=%s guisp=%s', + group, + cols.style or "NONE", + cols.fg or "NONE", + cols.bg or "NONE", + cols.sp or "NONE" + )) - if cols.link then - api.nvim_command(string.format("highlight! link %s %s", group, cols.link)) - end + if cols.link then + api.nvim_command(string.format("highlight! link %s %s", group, cols.link)) + end end -- Load colorscheme --@param scheme table: editor elements with its colors --@param custom_tab table: custom color table local function load_colorscheme(scheme, custom_tab) - local color_table = scheme or {} - local custom_colors = custom_tab or {} + local color_table = scheme or {} + local custom_colors = custom_tab or {} - -- reset the highlighting - if vim.fn.exists("sintax_on") then api.nvim_command("syntax reset") end - vim.opt.background = "dark" - vim.g.colors_name = "astronomy" - vim.g.astronomy = 1 - vim.opt.termguicolors = true + -- reset the highlighting + if vim.fn.exists("sintax_on") then api.nvim_command("syntax reset") end + vim.opt.background = "dark" + vim.g.colors_name = "astronomy" + vim.g.astronomy = 1 + vim.opt.termguicolors = true - if type(custom_colors) == "table" then - if next(custom_colors) ~= nil then - color_table = vim.tbl_deep_extend("force", {}, color_table, custom_colors) - end - end - - --Load editor colors - for grp, col in pairs(color_table) do - set_highlights(grp, col) + if type(custom_colors) == "table" then + if next(custom_colors) ~= nil then + color_table = vim.tbl_deep_extend("force", {}, color_table, custom_colors) end + end + --Load editor colors + for grp, col in pairs(color_table) do + set_highlights(grp, col) + end end -- Set and load the color scheme --@param opts table: custom options to be applied to the editor function M.setup_scheme(opts) - config.set_options(opts) - local sch_opts = config.scheme_options + config.set_options(opts) + local sch_opts = config.scheme_options - local scheme = colors.set_scheme(sch_opts.variant) - local colorscheme = theme.load_colors(scheme) + local scheme = colors.set_scheme(sch_opts.variant) + local colorscheme = theme.load_colors(scheme) - load_colorscheme(colorscheme, sch_opts.custom_colors) + load_colorscheme(colorscheme, sch_opts.custom_colors) end return M