This commit is contained in:
fiplox 2023-02-09 22:56:19 +01:00
commit 30c18041a3
8 changed files with 862 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Volodymyr Patuta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12
colors/neogruber.lua Normal file
View File

@ -0,0 +1,12 @@
-- Refresh cache for local debugging and development purposes
if vim.g.neogruber_debug == true then
package.loaded['neogruber'] = nil
package.loaded['neogruber.util'] = nil
package.loaded['neogruber.colors'] = nil
package.loaded['neogruber.colors.neogruber'] = nil
package.loaded['neogruber.theme'] = nil
end
local neogruber = require 'neogruber'
neogruber.load(false)

View File

@ -0,0 +1,16 @@
local dark_colors = require 'neogruber.colors.neogruber'
local function load()
local theme = require('neogruber.config').options.theme
-- if style is set, it takes priority
-- otherwise, use vim.o.background
if not theme then
theme = vim.o.background
end
local base_colors = dark_colors
return vim.tbl_deep_extend('force', base_colors, require('neogruber.config').options.custom_colors)
end
return { load = load }

View File

@ -0,0 +1,34 @@
local colors = {
fg_1 = '#d4dfdf',
fg = '#e4e4ef',
fg1 = '#f4f4ff',
fg2 = '#f5f5f5',
white = '#ffffff',
black = '#000000',
bg_1 = '#101010',
bg = '#181818',
bg1 = '#282828',
bg2 = '#453d41',
bg3 = '#484848',
bg4 = '#52494e',
bg5 = '#9998a8',
bg6 = '#c1c0d4',
red_1 = '#c73c3f',
red = '#f43841',
red1 = '#ff4f58',
green = '#73c936',
green1 = '#73da00',
yellow = '#ffdd11',
brown = '#cc8c3c',
quartz = '#95a99f',
niagara_2 = '#303540',
niagara_1 = '#565f73',
niagara = '#96a6c8',
wisteria = '#9e95c7',
wisteria1 = '#9f90f9',
light_blue = '#0087d7',
-- Special
none = 'NONE',
}
return colors

40
lua/neogruber/config.lua Normal file
View File

@ -0,0 +1,40 @@
local config = {}
local defaults = {
theme = nil, -- "dark" or "light". Alternatively, remove the option and set vim.o.background instead
borders = true, -- Split window borders
fade_nc = false, -- Fade non-current windows, making them more distinguishable
-- Style that is applied to various groups: see `highlight-args` for options
styles = {
comments = 'NONE',
strings = 'NONE',
keywords = 'NONE',
functions = 'NONE',
variables = 'NONE',
diagnostics = 'underline',
storage_class = 'NONE',
structure = 'NONE',
loop_cond = 'NONE',
},
disable = {
background = false, -- Disable setting the background color
cursorline = false, -- Disable the cursorline
eob_lines = true, -- Hide the end-of-buffer lines
},
-- Inverse highlight for different groups
inverse = {
match_paren = false,
},
custom_highlights = {}, -- Overwrite default highlight groups
custom_colors = {}, -- Overwrite default colors
}
config.options = {}
function config.set_options(opts)
config.options = vim.tbl_deep_extend('force', config.options, opts or {})
end
config.set_options(defaults)
return config

22
lua/neogruber/init.lua Normal file
View File

@ -0,0 +1,22 @@
-- Colorscheme name: neogruber.nvim
-- Description: A Neovim theme that combines the Nord and Atom One Dark color palettes.
-- Author: Ryan Mehri
-- Website: https://github.com/rmehri01/neogruber.nvim
local config = require 'neogruber.config'
local util = require 'neogruber.util'
local neogruber = {}
function neogruber.setup(options)
config.set_options(options)
neogruber.load(true)
end
function neogruber.load(exec_autocmd)
local colors = require('neogruber.colors').load()
util.load(colors, exec_autocmd)
end
return neogruber

664
lua/neogruber/theme.lua Normal file
View File

@ -0,0 +1,664 @@
local theme = {}
function theme.highlights(c, config)
local function remove_background(group)
group['bg'] = c.none
end
local function load_syntax()
-- Syntax highlight groups
local syntax = {
-- int, long, char, etc.
Type = { fg = c.quartz },
-- static, register, volatile, etc.
StorageClass = { fg = c.yellow, style = config.styles.storage_class },
-- struct, union, enum, etc.
Structure = { fg = c.yellow, style = config.styles.structure },
-- any constant
Constant = { fg = c.wisteria1 },
-- any character constant: 'c', '\n'
Character = { fg = c.green },
-- a number constant: 5
Number = { fg = c.quartz },
-- a boolean constant: TRUE, false
Boolean = { fg = c.quartz },
-- a floating point constant: 2.3e10
Float = { fg = c.quartz },
-- any statement
Statement = { fg = c.yellow },
-- case, default, etc.
Label = { fg = c.yellow },
-- sizeof", "+", "*", etc.
Operator = { fg = c.yellow },
-- try, catch, throw
Exception = { fg = c.yellow },
-- generic Preprocessor
PreProc = { fg = c.quartz },
-- preprocessor #include
Include = { fg = c.quartz },
-- preprocessor #define
Define = { fg = c.quartz },
-- same as Define
Macro = { fg = c.quartz },
-- A typedef
Typedef = { fg = c.yellow, style = config.styles.keywords },
-- preprocessor #if, #else, #endif, etc.
PreCondit = { fg = c.quartz },
-- any special symbol
Special = { fg = c.brown },
-- special character in a constant
SpecialChar = { fg = c.brown },
-- you can use CTRL-] on this
Tag = { fg = c.brown },
-- character that needs attention like , or .
Delimiter = { fg = c.brown },
-- special things inside a comment
SpecialComment = { fg = c.brown },
-- debugging statements
Debug = { fg = c.brown },
-- text that stands out, HTML links
Underlined = { style = 'underline' },
-- left blank, hidden
Ignore = {},
-- any erroneous construct
Error = { fg = c.red, style = 'bold,underline' },
-- anything that needs extra attention; mostly the keywords TODO FIXME and XXX
Todo = { fg = c.brown, style = 'bold,italic' },
Comment = { fg = c.bg3, style = config.styles.comments }, -- normal comments
-- normal if, then, else, endif, switch, etc.
Conditional = { fg = c.yellow, style = config.styles.loop_cond },
-- normal for, do, while, etc.
Keyword = { fg = c.yellow, style = config.styles.keywords },
-- normal any other keyword
Repeat = { fg = c.yellow, style = config.styles.loop_cond },
-- normal function names
Function = { fg = c.niagara, style = config.styles.functions },
-- any variable name
Identifier = { fg = c.niagara, style = config.styles.variables },
-- any string
String = { fg = c.green, config.styles.strings },
htmlLink = { fg = c.green, style = 'underline' },
htmlArg = { fg = c.light_blue },
htmlTag = { fg = c.bg6 },
htmlEndTag = { fg = c.bg6 },
htmlTagN = { fg = c.bg5 },
htmlTagName = { fg = c.light_blue },
htmlSpecialTagName = { fg = c.yellow },
htmlH1 = { fg = c.light_blue, style = 'bold' },
htmlH2 = { fg = c.wisteria1, style = 'bold' },
htmlH3 = { fg = c.niagara, style = 'bold' },
htmlH4 = { fg = c.wisteria, style = 'bold' },
htmlH5 = { fg = c.quartz, style = 'bold' },
cssAttributeSelector = { fg = c.light_blue },
cssSelectorOp = { fg = c.niagara1 },
cssTagName = { fg = c.yellow },
markdownBlockquote = { fg = c.bg6 },
markdownBold = { style = 'bold' },
markdownCode = { fg = c.yellow },
markdownCodeBlock = { fg = c.yellow },
markdownCodeDelimiter = { fg = c.green },
markdownH1 = { fg = c.light_blue, style = 'bold' },
markdownH2 = { fg = c.wisteria1, style = 'bold' },
markdownH3 = { fg = c.niagara, style = 'bold' },
markdownH4 = { fg = c.wisteria },
markdownH5 = { fg = c.quartz },
markdownH6 = { fg = c.green },
markdownH1Delimiter = { fg = c.bg5 },
markdownH2Delimiter = { fg = c.bg5 },
markdownH3Delimiter = { fg = c.bg5 },
markdownH4Delimiter = { fg = c.bg5 },
markdownH5Delimiter = { fg = c.bg5 },
markdownH6Delimiter = { fg = c.bg5 },
markdownId = { fg = c.yellow },
markdownIdDeclaration = { fg = c.niagara },
markdownIdDelimiter = { fg = c.light_blue },
markdownLinkDelimiter = { fg = c.bg5 },
markdownItalic = { style = 'italic' },
markdownLinkText = { fg = c.niagara },
markdownListMarker = { fg = c.red_1 },
markdownOrderedListMarker = { fg = c.red },
markdownRule = { fg = c.bg5 },
markdownUrl = { fg = c.green, style = 'underline' },
}
return syntax
end
local function load_editor()
-- Editor highlight groups
local editor = {
-- normal text and background color for floating windows
NormalFloat = { fg = c.fg, bg = c.bg1 },
-- floating window border
FloatBorder = { fg = c.yellow },
-- used for the columns set with 'colorcolumn'
ColorColumn = { bg = c.bg2 },
-- placeholder characters substituted for concealed text (see 'conceallevel')
Conceal = {},
-- the character under the cursor
Cursor = { bg = c.none, fg = c.none, style = 'reverse' },
-- like Cursor, but used when in IME mode
CursorIM = { fg = c.none, bg = c.none, style = 'reverse' },
-- directory names (and other special names in listings)
Directory = { fg = c.light_blue, bg = c.none },
-- diff mode: Added line
DiffAdd = { fg = c.none, bg = c.green },
-- diff mode: Changed line
DiffChange = { fg = c.none, bg = c.brown },
-- diff mode: Deleted line
DiffDelete = { fg = c.none, bg = c.red1 },
-- diff mode: Changed text within a changed line
DiffText = { fg = c.none, bg = c.green },
-- error messages
ErrorMsg = { fg = c.red_1 },
-- line used for closed folds
Folded = { fg = c.brown, bg = c.none, style = 'italic' },
-- 'foldcolumn'
FoldColumn = {},
-- 'incsearch' highlighting; also used for the text replaced with ":s///c"
IncSearch = { fg = c.yellow, bg = c.bg3, style = 'bold,underline' },
-- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
LineNr = { fg = c.bg3 },
-- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
CursorLineNr = { fg = c.yellow, style = config.styles.cursorlinenr },
-- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
MatchParen = { fg = c.wisteria1, bg = c.none, style = 'bold,underline' },
-- 'showmode' message (e.g., "-- INSERT -- ")
ModeMsg = { fg = c.light_blue, style = 'bold' },
-- |more-prompt|
MoreMsg = { fg = c.light_blue, style = 'bold' },
-- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist
-- in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line).
-- See also |hl-EndOfBuffer|.
NonText = { fg = c.bg2 },
-- normal item |hl-Pmenu|
Pmenu = { fg = c.fg, bg = c.bg1 },
-- selected item |hl-PmenuSel|
PmenuSel = { bg = c.bg2 },
-- scrollbar |hl-PmenuSbar|
PmenuSbar = { bg = c.bg },
-- thumb of the scrollbar |hl-PmenuThumb|
PmenuThumb = { bg = c.fg },
-- |hit-enter| prompt and yes/no questions
Question = { fg = c.green },
-- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there.
QuickFixLine = { bg = c.light_blue, style = 'bold,italic' },
-- Line numbers for quickfix lists
qfLineNr = { fg = c.yellow },
-- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
Search = { fg = c.fg2, bg = c.bg4, style = 'bold' },
-- Unprintable characters: text displayed differently from what it really is.
-- But not 'listchars' whitespace. |hl-Whitespace|
SpecialKey = { fg = c.bg6 },
-- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise.
SpellBad = { style = 'italic,undercurl' },
-- Word that should start with a capital. |spell| Combined with the highlighting used otherwise.
SpellCap = { fg = c.bg6 },
-- Word that is recognized by the spellchecker as one that is used in another region.
-- |spell| Combined with the highlighting used otherwise.
SpellLocal = { fg = c.brown },
-- Word that is recognized by the spellchecker as one that is hardly ever used.
-- |spell| Combined with the highlighting used otherwise.
SpellRare = { fg = c.brown },
-- status line of current window
StatusLine = { fg = c.white, bg = c.bg1 },
-- status lines of not-current windows Note: if this is equal to "StatusLine"
-- Vim will use "^^^" in the status line of the current window.
StatusLineNC = { fg = c.bg5 },
-- status line of current terminal window
StatusLineTerm = { fg = c.fg, bg = c.bg1 },
-- status lines of not-current terminal windows Note: if this is equal to "StatusLine"
-- Vim will use "^^^" in the status line of the current window.
StatusLineTermNC = { fg = c.bg5 },
-- tab pages line, where there are no labels
TabLineFill = {},
-- tab pages line, active tab page label
TablineSel = { fg = c.white },
Tabline = { fg = c.bg5 },
-- titles for output from ":set all", ":autocmd" etc.
Title = { fg = c.green, bg = c.none, style = 'bold' },
-- Visual mode selection
Visual = { fg = c.none, bg = c.bg1 },
-- Visual mode selection when vim is "Not Owning the Selection".
VisualNOS = { fg = c.none, bg = c.bg1 },
-- warning messages
WarningMsg = { fg = c.red_1 },
-- "nbsp", "space", "tab" and "trail" in 'listchars'
Whitespace = { fg = c.bg3 },
-- current match in 'wildmenu' completion
WildMenu = { fg = c.black, bg = c.niagara, style = 'bold' },
-- window bar of current window
WinBar = { fg = c.white, bg = c.bg1 },
-- window bar of not-current windows
WinBarNC = { fg = c.bg6, bg = c.bg_1 },
-- Screen-column at the cursor, when 'cursorcolumn' is set.
CursorColumn = { fg = c.none, bg = c.bg1 },
-- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set.
CursorLine = { fg = c.none, bg = c.bg1 },
-- Normal mode message in the cmdline
NormalMode = { fg = c.light_blue, bg = c.none, style = 'reverse' },
-- Insert mode message in the cmdline
InsertMode = { fg = c.green, bg = c.none, style = 'reverse' },
-- Replace mode message in the cmdline
ReplacelMode = { fg = c.red, bg = c.none, style = 'reverse' },
-- Visual mode message in the cmdline
VisualMode = { fg = c.wisteria1, bg = c.none, style = 'reverse' },
-- Command mode message in the cmdline
CommandMode = { fg = c.yellow, bg = c.none, style = 'reverse' },
Warnings = { fg = c.red1 },
healthError = { fg = c.red },
healthSuccess = { fg = c.green },
healthWarning = { fg = c.red_1 },
-- Dashboard
DashboardShortCut = { fg = c.light_blue },
DashboardHeader = { fg = c.wisteria1 },
DashboardCenter = { fg = c.niagara },
DashboardFooter = { fg = c.green, style = 'italic' },
-- normal text and background color
Normal = { fg = c.fg, bg = c.bg },
NormalNC = { bg = c.bg },
SignColumn = { fg = c.fg, bg = c.none },
-- the column separating vertically split windows
VertSplit = { fg = c.bg },
EndOfBuffer = { fg = c.bg6 },
}
-- Options:
-- Set non-current background
if config.fade_nc then
editor.NormalNC['bg'] = c.gb1
editor.NormalFloat['bg'] = c.bg
editor.FloatBorder['bg'] = c.bg
end
-- Set transparent background
if config.disable.background then
remove_background(editor.Normal)
remove_background(editor.NormalNC)
remove_background(editor.SignColumn)
end
-- Set transparent cursorline
if config.disable.cursorline then
remove_background(editor.CursorLine)
end
-- Set transparent eob lines
if config.disable.eob_lines then
editor.EndOfBuffer['fg'] = c.bg
end
-- Inverse highlighting
if config.inverse.match_paren then
editor.MatchParen['style'] = 'reverse,bold'
end
-- Add window split borders
if config.borders then
editor.VertSplit['fg'] = c.niagara_2
end
return editor
end
local function load_treesitter()
-- TreeSitter highlight groups
local treesitter = {
-- Annotations that can be attached to the code to denote some kind of meta information. e.g. C++/Dart attributes.
['@attribute'] = { fg = c.yellow },
-- Boolean literals: `True` and `False` in Python.
['@boolean'] = { fg = c.quartz },
-- Character literals: `'a'` in C.
['@character'] = { fg = c.green },
-- Line comments and block comments.
['@comment'] = { fg = c.bg3, style = config.styles.comments },
-- Keywords related to conditionals: `if`, `when`, `cond`, etc.
['@conditional'] = { fg = c.yellow, style = config.styles.loop_cond },
-- Constants identifiers. These might not be semantically constant. E.g. uppercase variables in Python.
['@constant'] = { fg = c.wisteria1 },
-- Built-in constant values: `nil` in Lua.
['@constant.builtin'] = { fg = c.wisteria1 },
-- Constants defined by macros: `NULL` in C.
['@constant.macro'] = { fg = c.wisteria1 },
-- Constructor calls and definitions: `{}` in Lua, and Java constructors.
['@constructor'] = { fg = c.yellow },
-- Syntax/parser errors. This might highlight large sections of code while the user is typing
-- still incomplete code, use a sensible highlight.
['@error'] = { fg = c.red },
-- Exception related keywords: `try`, `except`, `finally` in Python.
['@exception'] = { fg = c.yellow },
-- Object and struct fields.
['@field'] = { fg = c.niagara },
-- Floating-point number literals.
['@float'] = { fg = c.quartz },
-- Function calls and definitions.
['@function'] = { fg = c.fg_1, style = config.styles.functions },
-- Built-in functions: `print` in Lua.
['@function.builtin'] = { fg = c.light_blie, style = config.styles.functions },
-- Macro defined functions (calls and definitions): each `macro_rules` in Rust.
['@function.macro'] = { fg = c.yellow },
-- File or module inclusion keywords: `#include` in C, `use` or `extern crate` in Rust.
['@include'] = { fg = c.quartz },
-- Keywords that don't fit into other categories.
['@keyword'] = { fg = c.yellow, style = config.styles.keywords },
-- Keywords used to define a function: `function` in Lua, `def` and `lambda` in Python.
['@keyword.function'] = { fg = c.yellow, style = config.styles.keywords },
-- Unary and binary operators that are English words: `and`, `or` in Python; `sizeof` in C.
['@keyword.operator'] = { fg = c.yellow },
-- Keywords like `return` and `yield`.
['@keyword.return'] = { fg = c.yellow },
-- GOTO labels: `label:` in C, and `::label::` in Lua.
['@label'] = { fg = c.yellow },
-- Method calls and definitions.
['@method'] = { fg = c.quartz, style = config.styles.functions },
-- Identifiers referring to modules and namespaces.
['@namespace'] = { fg = c.niagara },
-- Numeric literals that don't fit into other categories.
['@number'] = { fg = c.brown },
-- Binary or unary operators: `+`, and also `->` and `*` in C.
['@operator'] = { fg = c.bg6 },
-- Parameters of a function.
['@parameter'] = { fg = c.wisteria }, -- TODO: see what it does
-- References to parameters of a function.
['@parameter.reference'] = { fg = c.wisteria },
-- Same as `@field`.
['@property'] = { fg = c.wisteria1 },
-- Punctuation delimiters: Periods, commas, semicolons, etc.
['@punctuation.delimiter'] = { fg = c.niagara },
-- Brackets, braces, parentheses, etc.
['@punctuation.bracket'] = { fg = c.niagara_1 },
-- Special punctuation that doesn't fit into the previous categories.
['@punctuation.special'] = { fg = c.niagara },
-- Keywords related to loops: `for`, `while`, etc.
['@repeat'] = { fg = c.yellow, style = config.styles.loop_cond },
-- String literals.
['@string'] = { fg = c.green, style = config.styles.strings },
-- Regular expression literals.
['@string.regex'] = { fg = c.brown },
-- Escape characters within a string: `\n`, `\t`, etc.
['@string.escape'] = { fg = c.brown },
-- Identifiers referring to symbols or atoms.
['@symbol'] = { fg = c.light_blue },
-- Tags like HTML tag names.
['@tag'] = { fg = c.yellow },
-- HTML tag attributes.
['@tag.attribute'] = { fg = c.bg6 },
-- Tag delimiters like `<` `>` `/`.
['@tag.delimiter'] = { fg = c.fg2 },
-- Non-structured text. Like text in a markup language.
['@text'] = { fg = c.fg },
-- Text to be represented in bold.
['@text.strong'] = { style = 'bold' },
-- Text to be represented with emphasis.
['@text.emphasis'] = { style = 'italic' },
-- Text to be represented with an underline.
['@text.underline'] = { style = 'underline' },
-- Text that is part of a title.
['@text.title'] = { fg = c.wisteria1, style = 'bold' },
-- Literal or verbatim text.
['@text.literal'] = { fg = c.green },
-- added text (for diff files)
['@text.diff.add'] = { fg = c.green },
-- deleted text (for diff files)
['@text.diff.delete'] = { fg = c.red_1 },
-- URIs like hyperlinks or email addresses.
['@text.uri'] = { fg = c.green, style = 'underline' },
-- Math environments like LaTeX's `$ ... $`
['@text.math'] = { fg = c.fg },
-- Footnotes, text references, citations, etc.
['@text.reference'] = { fg = c.brown },
-- Text environments of markup languages.
['@text.environment'] = { fg = c.fg },
-- Text/string indicating the type of text environment. Like the name of a `\begin` block in LaTeX.
['@text.environment.name'] = { fg = c.fg },
-- Text TODOS
['@text.todo'] = { fg = c.brown, style = 'bold' },
-- Text representation of an informational note.
['@note'] = { fg = c.yellow, style = 'bold' },
-- Text representation of a warning note.
['@warning'] = { fg = c.red_1, style = 'bold' },
-- Text representation of a danger note.
['@danger'] = { fg = c.red1, style = 'bold' },
-- Type (and class) definitions and annotations.
['@type'] = { fg = c.yellow, style = config.styles.storage_class },
-- Built-in types: `i32` in Rust.
['@type.builtin'] = { fg = c.quartz },
-- Variable names that don't fit into other categories.
['@variable'] = { fg = c.fg, style = config.styles.variables },
-- Variable names defined by the language: `this` or `self` in Javascript.
['@variable.builtin'] = { fg = c.wisteria, style = config.styles.variables },
}
return treesitter
end
local function load_lsp()
-- Lsp highlight groups
local lsp = {
-- used for "Error" diagnostic virtual text
LspDiagnosticsDefaultError = { fg = c.red1 },
-- used for "Error" diagnostic signs in sign column
LspDiagnosticsSignError = { fg = c.red1 },
-- used for "Error" diagnostic messages in the diagnostics float
LspDiagnosticsFloatingError = { fg = c.red1 },
-- Virtual text "Error"
LspDiagnosticsVirtualTextError = { fg = c.red1 },
-- used to underline "Error" diagnostics.
LspDiagnosticsUnderlineError = { style = config.styles.diagnostics, sp = c.red1 },
-- used for "Warning" diagnostic signs in sign column
LspDiagnosticsDefaultWarning = { fg = c.red_1 },
-- used for "Warning" diagnostic signs in sign column
LspDiagnosticsSignWarning = { fg = c.red_1 },
-- used for "Warning" diagnostic messages in the diagnostics float
LspDiagnosticsFloatingWarning = { fg = c.red_1 },
-- Virtual text "Warning"
LspDiagnosticsVirtualTextWarning = { fg = c.red_1 },
-- used to underline "Warning" diagnostics.
LspDiagnosticsUnderlineWarning = { style = config.styles.diagnostics, sp = c.red_1 },
-- used for "Information" diagnostic virtual text
LspDiagnosticsDefaultInformation = { fg = c.yellow },
-- used for "Information" diagnostic signs in sign column
LspDiagnosticsSignInformation = { fg = c.yellow },
-- used for "Information" diagnostic messages in the diagnostics float
LspDiagnosticsFloatingInformation = { fg = c.yellow },
-- Virtual text "Information"
LspDiagnosticsVirtualTextInformation = { fg = c.yellow },
-- used to underline "Information" diagnostics.
LspDiagnosticsUnderlineInformation = { style = config.styles.diagnostics, sp = c.yellow },
-- used for "Hint" diagnostic virtual text
LspDiagnosticsDefaultHint = { fg = c.wisteria },
-- used for "Hint" diagnostic signs in sign column
LspDiagnosticsSignHint = { fg = c.wisteria },
-- used for "Hint" diagnostic messages in the diagnostics float
LspDiagnosticsFloatingHint = { fg = c.wisteria },
-- Virtual text "Hint"
LspDiagnosticsVirtualTextHint = { fg = c.wisteria },
-- used to underline "Hint" diagnostics.
LspDiagnosticsUnderlineHint = { style = config.styles.diagnostics, sp = c.wisteria },
-- used for highlighting "text" references
LspReferenceText = { style = 'underline', sp = c.yellow },
-- used for highlighting "read" references
LspReferenceRead = { style = 'underline', sp = c.yellow },
-- used for highlighting "write" references
LspReferenceWrite = { style = 'underline', sp = c.yellow },
LspSignatureActiveParameter = { fg = c.none, bg = c.bg2, style = 'bold' },
LspCodeLens = { fg = c.bg5 },
DiagnosticError = { link = 'LspDiagnosticsDefaultError' },
DiagnosticWarn = { link = 'LspDiagnosticsDefaultWarning' },
DiagnosticInfo = { link = 'LspDiagnosticsDefaultInformation' },
DiagnosticHint = { link = 'LspDiagnosticsDefaultHint' },
DiagnosticVirtualTextWarn = { link = 'LspDiagnosticsVirtualTextWarning' },
DiagnosticUnderlineWarn = { link = 'LspDiagnosticsUnderlineWarning' },
DiagnosticFloatingWarn = { link = 'LspDiagnosticsFloatingWarning' },
DiagnosticSignWarn = { link = 'LspDiagnosticsSignWarning' },
DiagnosticVirtualTextError = { link = 'LspDiagnosticsVirtualTextError' },
DiagnosticUnderlineError = { link = 'LspDiagnosticsUnderlineError' },
DiagnosticFloatingError = { link = 'LspDiagnosticsFloatingError' },
DiagnosticSignError = { link = 'LspDiagnosticsSignError' },
DiagnosticVirtualTextInfo = { link = 'LspDiagnosticsVirtualTextInformation' },
DiagnosticUnderlineInfo = { link = 'LspDiagnosticsUnderlineInformation' },
DiagnosticFloatingInfo = { link = 'LspDiagnosticsFloatingInformation' },
DiagnosticSignInfo = { link = 'LspDiagnosticsSignInformation' },
DiagnosticVirtualTextHint = { link = 'LspDiagnosticsVirtualTextHint' },
DiagnosticUnderlineHint = { link = 'LspDiagnosticsUnderlineHint' },
DiagnosticFloatingHint = { link = 'LspDiagnosticsFloatingHint' },
DiagnosticSignHint = { link = 'LspDiagnosticsSignHint' },
}
return lsp
end
local function load_plugins()
-- Plugins highlight groups
local plugins = {
-- Cmp
CmpItemAbbr = { fg = c.fg },
CmpItemAbbrDeprecated = { fg = c.fg },
CmpItemAbbrMatch = { fg = c.wisteria, style = 'bold' },
CmpItemAbbrMatchFuzzy = { fg = c.wisteria, underline = true },
CmpItemMenu = { fg = c.bg5 },
CmpItemKindText = { fg = c.brown },
CmpItemKindMethod = { fg = c.wisteria },
CmpItemKindFunction = { fg = c.wisteria },
CmpItemKindConstructor = { fg = c.yellow },
CmpItemKindField = { fg = c.wisteria },
CmpItemKindClass = { fg = c.yellow },
CmpItemKindInterface = { fg = c.yellow },
CmpItemKindModule = { fg = c.wisteria },
CmpItemKindProperty = { fg = c.wisteria },
CmpItemKindValue = { fg = c.brown },
CmpItemKindEnum = { fg = c.yellow },
CmpItemKindKeyword = { fg = c.wisteria1 },
CmpItemKindSnippet = { fg = c.green },
CmpItemKindFile = { fg = c.wisteria },
CmpItemKindEnumMember = { fg = c.light_blue },
CmpItemKindConstant = { fg = c.brown },
CmpItemKindStruct = { fg = c.yellow },
CmpItemKindTypeParameter = { fg = c.yellow },
-- Notify
NotifyERRORBorder = { fg = c.red1 },
NotifyWARNBorder = { fg = c.red_1 },
NotifyINFOBorder = { fg = c.yellow },
NotifyDEBUGBorder = { fg = c.bg5 },
NotifyTRACEBorder = { fg = c.wisteria },
NotifyERRORIcon = { fg = c.red1 },
NotifyWARNIcon = { fg = c.red_1 },
NotifyINFOIcon = { fg = c.yellow },
NotifyDEBUGIcon = { fg = c.bg5 },
NotifyTRACEIcon = { fg = c.wisteria },
NotifyERRORTitle = { fg = c.red1 },
NotifyWARNTitle = { fg = c.red_1 },
NotifyINFOTitle = { fg = c.yellow },
NotifyDEBUGTitle = { fg = c.bg5 },
NotifyTRACETitle = { fg = c.wisteria },
-- Trouble
TroubleCount = { fg = c.wisteria1 },
TroubleNormal = { fg = c.fg },
TroubleText = { fg = c.fg },
-- Diff
diffAdded = { fg = c.green },
diffRemoved = { fg = c.red_1 },
diffChanged = { fg = c.yellow },
diffOldFile = { fg = c.brown },
diffNewFile = { fg = c.light_blue },
diffFile = { fg = c.wisteria },
diffLine = { fg = c.bg5 },
diffIndexLine = { fg = c.wisteria1 },
-- Neogit
NeogitBranch = { fg = c.wisteria1 },
NeogitRemote = { fg = c.brown },
NeogitHunkHeader = { fg = c.fg, bg = c.bg1 },
NeogitHunkHeaderHighlight = { fg = c.yellow, bg = c.bg1 },
NeogitDiffContextHighlight = { bg = c.bg1 },
NeogitDiffDeleteHighlight = { fg = c.red },
NeogitDiffAddHighlight = { fg = c.green },
NeogitNotificationInfo = { fg = c.yellow },
NeogitNotificationWarning = { fg = c.red_1 },
NeogitNotificationError = { fg = c.red1 },
-- WhichKey
WhichKey = { fg = c.wisteria1, style = 'bold' },
WhichKeyGroup = { fg = c.light_blue },
WhichKeyDesc = { fg = c.wisteria, style = 'italic' },
WhichKeySeperator = { fg = c.green },
WhichKeyFloat = { bg = c.bg1 },
-- nvim-treesitter-context
TreesitterContext = { fg = c.none, bg = c.bg1 },
-- Indent Blankline
IndentBlanklineChar = { fg = c.niagara_2, style = 'nocombine' },
IndentBlanklineSpaceChar = { fg = c.bg5, style = 'nocombine' },
IndentBlanklineSpaceCharBlankline = { fg = c.bg5, style = 'nocombine' },
IndentBlanklineContextChar = { fg = c.wisteria1, style = 'nocombine' },
IndentBlanklineContextStart = { style = 'underline', sp = c.wisteria1 },
-- Nvim dap
DapBreakpoint = { fg = c.red },
DapStopped = { fg = c.green },
-- Hop
HopNextKey = { fg = c.red1, style = 'bold' },
HopNextKey1 = { fg = c.light_blue, style = 'bold' },
HopNextKey2 = { fg = c.wisteria1 },
HopUnmatched = { fg = c.bg5 },
}
return plugins
end
function theme.load_terminal()
-- dark
vim.g.terminal_color_0 = c.bg1
vim.g.terminal_color_8 = c.niagara_2
-- light
vim.g.terminal_color_7 = c.fg
vim.g.terminal_color_15 = c.white
-- colors
vim.g.terminal_color_1 = c.red
vim.g.terminal_color_9 = c.red1
vim.g.terminal_color_2 = c.green
vim.g.terminal_color_10 = c.green
vim.g.terminal_color_3 = c.yellow
vim.g.terminal_color_11 = c.yellow
vim.g.terminal_color_4 = c.wisteria
vim.g.terminal_color_12 = c.wisteria
vim.g.terminal_color_5 = c.wisteria1
vim.g.terminal_color_13 = c.wisteria1
vim.g.terminal_color_6 = c.light_blue
vim.g.terminal_color_14 = c.light_blue
end
return vim.tbl_deep_extend('error', load_syntax(), load_editor(), load_treesitter(), load_lsp(), load_plugins())
end
return theme

53
lua/neogruber/util.lua Normal file
View File

@ -0,0 +1,53 @@
local theme = require 'neogruber.theme'
local util = {}
-- Highlight the given group according to the color values
function util.highlight(group, colors)
local style = colors.style and 'gui=' .. colors.style or 'gui=NONE'
local fg = colors.fg and 'guifg=' .. colors.fg or 'guifg=NONE'
local bg = colors.bg and 'guibg=' .. colors.bg or 'guibg=NONE'
local sp = colors.sp and 'guisp=' .. colors.sp or ''
local hl = 'highlight ' .. group .. ' ' .. style .. ' ' .. fg .. ' ' .. bg .. ' ' .. sp
vim.cmd(hl)
if colors.link then
vim.cmd('highlight! link ' .. group .. ' ' .. colors.link)
end
end
-- Load the theme
function util.load(colors, exec_autocmd)
local config = require('neogruber.config').options
-- Set the theme environment
if vim.g.colors_name then
vim.cmd 'hi clear'
end
if vim.fn.exists 'syntax_on' then
vim.cmd 'syntax reset'
end
vim.o.termguicolors = true
vim.g.colors_name = 'neogruber'
-- Load highlights
colors = vim.tbl_deep_extend('force', colors, config.custom_colors)
local base_highlights = theme.highlights(colors, config)
local highlights = vim.tbl_deep_extend('force', base_highlights, config.custom_highlights)
for group, color in pairs(highlights) do
util.highlight(group, color)
end
theme.load_terminal()
if exec_autocmd then
vim.cmd 'doautocmd ColorScheme'
end
end
return util