fix: resolve merge conflicts and make some slight modifications

This commit is contained in:
Daniel Hill 2023-03-13 21:49:38 -04:00
commit ea213f8321
5 changed files with 112 additions and 99 deletions

View File

@ -3,30 +3,57 @@
_A modern Neovim port of a deftheme [adaptation][gruber-darker-theme] of an Emacs _A modern Neovim port of a deftheme [adaptation][gruber-darker-theme] of an Emacs
[port][gruber-darker] of a BBEdit [colorscheme][gruber-dark]_ [port][gruber-darker] of a BBEdit [colorscheme][gruber-dark]_
__This is a work in progress, and is not currently stable__ **This is a work in progress**
## Installation ## Installation
### Lazy
```lua
{ "blazkowolf/gruber-darker.nvim" }
```
### Packer ### Packer
```lua ```lua
use "blazkowolf/gruber-darker.nvim" use "blazkowolf/gruber-darker.nvim"
``` ```
### Plug
```vim
Plug 'blazkowolf/gruber-darker.nvim'
```
Then, somewhere in your `init.lua`, set the colorscheme like this Then, somewhere in your `init.lua`, set the colorscheme like this
```lua ```lua
vim.cmd.colorscheme("GruberDarker") vim.cmd.colorscheme("GruberDarker")
``` ```
## Special thanks ## Configuration
Configuration options can be changed by calling `setup()`
with your preferences prior to loading the colorscheme.
```lua
-- Config defaults
require("gruber-darker").setup({
bold = true,
italic = true,
underline = true,
comment_italics = true,
})
```
## Credits
These repositories were great knowledge sources and their These repositories were great knowledge sources and their
inspiration helped immensely with the development of this plugin. inspiration helped immensely with the development of this plugin.
- [rexim/gruber-darker-theme][gruber-darker-theme] - [rexim/gruber-darker-theme][gruber-darker-theme]
- [folke/tokyonight.nvim][tokyonight] - [folke/tokyonight.nvim][tokyonight]
- [drsooch/gruber-darker-vim][gruber-darker-theme] - [drsooch/gruber-darker-vim][gruber-darker-vim]
[gruber-darker-theme]: https://github.com/rexim/gruber-darker-theme [gruber-darker-theme]: https://github.com/rexim/gruber-darker-theme
[gruber-darker]: https://jblevins.org/projects/emacs-color-themes/gruber-darker-theme.el.html [gruber-darker]: https://jblevins.org/projects/emacs-color-themes/gruber-darker-theme.el.html

View File

@ -10,4 +10,4 @@
-- vim.api.nvim_create_user_command("GruberDarkerTest", R, {}) -- vim.api.nvim_create_user_command("GruberDarkerTest", R, {})
require("gruber-darker").setup() require("gruber-darker").load()

View File

@ -1,40 +1,33 @@
---@class ConfigMgr ---@class ConfigMgr
---@field private resolved_opts Options|nil ---@field private resolved_opts Options
---@class Options ---@class Options
---@field message string ---@field bold boolean
---@field italic boolean
---@field underline boolean
---@field comment_italics boolean
---@type ConfigMgr ---@type ConfigMgr
local M = { local M = {
resolved_opts = nil, resolved_opts = {
bold = true,
italic = true,
underline = true,
comment_italics = true,
},
} }
---Get default GruberDarker colorscheme options ---Get GruberDarker user preferences
---@return Options ---@return Options
---@nodiscard ---@nodiscard
function M.get_default_opts()
return {
message = "Big Hello",
}
end
---Get GruberDarker user preferences
---@return Options|nil
---@nodiscard
function M.get_resolved_opts() function M.get_resolved_opts()
return M.resolved_opts return M.resolved_opts
end end
---Set GruberDarker colorscheme options ---Set GruberDarker colorscheme options
---@param opts Options ---@param opts Options
function M.set(opts) function M.set(opts)
-- If user already called GruberDarker setup M.resolved_opts = vim.tbl_deep_extend("force", M.resolved_opts, opts)
-- either with/without default options
if M.resolved_opts ~= nil then
return
end
M.resolved_opts = vim.tbl_deep_extend("force", M.get_default_opts(), opts)
end end
return M return M

View File

@ -1,9 +1,10 @@
local c = require("gruber-darker.palette") local c = require("gruber-darker.palette")
local config = require("gruber-darker.config").get_resolved_opts()
local M = {} local M = {}
M.groups = { M.groups = {
Comment = { fg = c.default.brown }, -- any comment Comment = { fg = c.default.brown, italic = config.comment_italics and config.italic }, -- any comment
ColorColumn = { bg = c.default["bg+2"] }, -- used for the columns set with 'colorcolumn' ColorColumn = { bg = c.default["bg+2"] }, -- used for the columns set with 'colorcolumn'
Conceal = { fg = c.default.fg, bg = c.default.bg }, -- placeholder characters substituted for concealed text (see 'conceallevel') Conceal = { fg = c.default.fg, bg = c.default.bg }, -- placeholder characters substituted for concealed text (see 'conceallevel')
Cursor = { bg = c.default.yellow }, -- character under the cursor Cursor = { bg = c.default.yellow }, -- character under the cursor
@ -13,15 +14,15 @@ M.groups = {
CursorLine = { bg = c.default["bg+1"] }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. CursorLine = { bg = c.default["bg+1"] }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set.
-- Directory = { fg = c.default.lightblue }, -- directory names (and other special names in listings) -- Directory = { fg = c.default.lightblue }, -- directory names (and other special names in listings)
DiffAdd = { fg = c.default.green, bg = c.default.none }, -- diff mode: Added line |diff.txt| DiffAdd = { fg = c.default.green, bg = c.default.none }, -- diff mode: Added line |diff.txt|
DiffChange = { bg = c.default.yellow }, -- diff mode: Changed line |diff.txt| DiffChange = { fg = c.default.yellow, bg = c.default.none }, -- diff mode: Changed line |diff.txt|
DiffDelete = { fg = c.default["red+1"], bg = c.default.none }, -- diff mode: Deleted line |diff.txt| DiffDelete = { fg = c.default["red+1"], bg = c.default.none }, -- diff mode: Deleted line |diff.txt|
-- DiffText = { bg = c.diff.text }, -- diff mode: Changed text within a changed line |diff.txt| DiffText = { fg = c.default.yellow, bg = c.default.none }, -- diff mode: Changed text within a changed line |diff.txt|
EndOfBuffer = { fg = c.default.fg, bg = c.default.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. EndOfBuffer = { fg = c.default.fg, bg = c.default.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
-- TermCursor = { }, -- cursor in a focused terminal TermCursor = { bg = c.default.yellow }, -- cursor in a focused terminal
-- TermCursorNC= { }, -- cursor in an unfocused terminal -- TermCursorNC= { }, -- cursor in an unfocused terminal
ErrorMsg = { fg = c.default.white, bg = c.default.red }, -- error messages on the command line ErrorMsg = { fg = c.default.white, bg = c.default.red }, -- error messages on the command line
VertSplit = { fg = c.default["fg+2"], bg = c.default["bg+1"] }, -- the column separating vertically split windows VertSplit = { fg = c.default["fg+2"], bg = c.default["bg+1"] }, -- the column separating vertically split windows
WinSeparator = { fg = c.default["bg+2"], bold = true }, -- the column separating vertically split windows WinSeparator = { fg = c.default["bg+2"], bold = config.bold }, -- the column separating vertically split windows
Folded = { fg = c.default.brown, bg = c.default["fg+2"], italic = true }, -- line used for closed folds Folded = { fg = c.default.brown, bg = c.default["fg+2"], italic = true }, -- line used for closed folds
FoldColumn = { fg = c.default.brown, bg = c.default["fg+2"] }, -- 'foldcolumn' FoldColumn = { fg = c.default.brown, bg = c.default["fg+2"] }, -- 'foldcolumn'
SignColumn = { fg = c.default["bg+2"], bg = c.default.none }, -- column where |signs| are displayed SignColumn = { fg = c.default["bg+2"], bg = c.default.none }, -- column where |signs| are displayed
@ -29,7 +30,7 @@ M.groups = {
-- Substitute = { bg = c.red, fg = c.black }, -- |:substitute| replacement text highlighting -- Substitute = { bg = c.red, fg = c.black }, -- |:substitute| replacement text highlighting
LineNr = { fg = c.default["bg+4"] }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. LineNr = { fg = c.default["bg+4"] }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
CursorLineNr = { fg = c.default.yellow }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. CursorLineNr = { fg = c.default.yellow }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
MatchParen = { fg = c.default["bg+2"], bg = c.default.yellow }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| MatchParen = { fg = c.default.fg, bg = c.default.wisteria }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
ModeMsg = { fg = c.default["fg+2"] }, -- 'showmode' message (e.g., "-- INSERT -- ") ModeMsg = { fg = c.default["fg+2"] }, -- 'showmode' message (e.g., "-- INSERT -- ")
-- MsgArea = { fg = c.fg_dark }, -- Area for messages and cmdline -- MsgArea = { fg = c.fg_dark }, -- Area for messages and cmdline
-- MsgSeparator= { }, -- Separator for scrolled messages, `msgsep` flag of 'display' -- MsgSeparator= { }, -- Separator for scrolled messages, `msgsep` flag of 'display'
@ -45,7 +46,7 @@ M.groups = {
PmenuSbar = { bg = c.default.bg }, -- Popup menu: scrollbar. PmenuSbar = { bg = c.default.bg }, -- Popup menu: scrollbar.
PmenuThumb = { bg = c.default.bg }, -- Popup menu: Thumb of the scrollbar. PmenuThumb = { bg = c.default.bg }, -- Popup menu: Thumb of the scrollbar.
Question = { fg = c.default.niagara }, -- |hit-enter| prompt and yes/no questions Question = { fg = c.default.niagara }, -- |hit-enter| prompt and yes/no questions
-- QuickFixLine = { bg = c.bg_visual, bold = true }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. QuickFixLine = { bg = c.default["bg+2"], bold = config.bold }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there.
Search = { fg = c.default.black, bg = c.default.yellow }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. Search = { fg = c.default.black, bg = c.default.yellow }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
IncSearch = { fg = c.default.black, bg = c.default["fg+2"] }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" IncSearch = { fg = c.default.black, bg = c.default["fg+2"] }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c"
CurSearch = { link = "IncSearch" }, CurSearch = { link = "IncSearch" },
@ -58,12 +59,12 @@ M.groups = {
StatusLineNC = { fg = c.default.quartz, bg = c.default["bg+1"] }, -- 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.default.quartz, bg = c.default["bg+1"] }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
TabLine = { bg = c.default.none }, -- tab pages line, not active tab page label TabLine = { bg = c.default.none }, -- tab pages line, not active tab page label
TabLineFill = { fg = c.default["bg+4"], bg = c.default["bg+1"] }, -- tab pages line, where there are no labels TabLineFill = { fg = c.default["bg+4"], bg = c.default["bg+1"] }, -- tab pages line, where there are no labels
TabLineSel = { fg = c.default.yellow, bg = c.default.none, bold = true }, -- tab pages line, active tab page label TabLineSel = { fg = c.default.yellow, bg = c.default.none, bold = config.bold }, -- tab pages line, active tab page label
Title = { fg = c.default.quartz }, -- titles for output from ":set all", ":autocmd" etc. Title = { fg = c.default.quartz }, -- titles for output from ":set all", ":autocmd" etc.
Visual = { bg = c.default["bg+2"] }, -- Visual mode selection Visual = { bg = c.default["bg+2"] }, -- Visual mode selection
VisualNOS = { fg = c.default.red }, -- Visual mode selection when vim is "Not Owning the Selection". VisualNOS = { fg = c.default.red }, -- Visual mode selection when vim is "Not Owning the Selection".
WarningMsg = { fg = c.default.red }, -- warning messages WarningMsg = { fg = c.default.red }, -- warning messages
-- Whitespace = { fg = c.default.black, bg = c.default.red }, -- "nbsp", "space", "tab" and "trail" in 'listchars' Whitespace = { fg = c.default["bg+4"], bg = c.default.none }, -- "nbsp", "space", "tab" and "trail" in 'listchars'
WildMenu = { fg = c.default.black, bg = c.default.yellow }, -- current match in 'wildmenu' completion WildMenu = { fg = c.default.black, bg = c.default.yellow }, -- current match in 'wildmenu' completion
-- These groups are not listed as default vim groups, -- These groups are not listed as default vim groups,
@ -75,31 +76,31 @@ M.groups = {
Constant = { fg = c.default.quartz }, -- (preferred) any constant Constant = { fg = c.default.quartz }, -- (preferred) any constant
String = { fg = c.default.green }, -- a string constant: "this is a string" String = { fg = c.default.green }, -- a string constant: "this is a string"
Character = { fg = c.default.green }, -- a character constant: 'c', '\n' Character = { fg = c.default.green }, -- a character constant: 'c', '\n'
-- Number = { }, -- a number constant: 234, 0xff Number = { fg = c.default.fg }, -- a number constant: 234, 0xff
-- Boolean = { }, -- a boolean constant: TRUE, false Boolean = { fg = c.default.yellow, bold = config.bold }, -- a boolean constant: TRUE, false
-- Float = { }, -- a floating point constant: 2.3e10 Float = { fg = c.default.yellow, bold = config.bold }, -- a floating point constant: 2.3e10
Identifier = { fg = c.default["fg+1"] }, -- (preferred) any variable name Identifier = { fg = c.default["fg+1"] }, -- (preferred) any variable name
Function = { fg = c.default.niagara }, -- function name (also: methods for classes) Function = { fg = c.default.niagara }, -- function name (also: methods for classes)
Statement = { fg = c.default.yellow }, -- (preferred) any statement Statement = { fg = c.default.yellow }, -- (preferred) any statement
-- Conditional = { }, -- if, then, else, endif, switch, etc. Conditional = { fg = c.default.yellow, bold = config.bold }, -- if, then, else, endif, switch, etc.
-- Repeat = { }, -- for, do, while, etc. Repeat = { fg = c.default.yellow, bold = config.bold }, -- for, do, while, etc.
-- Label = { }, -- case, default, etc. Label = { fg = c.default.yellow, bold = config.bold }, -- case, default, etc.
Operator = { fg = c.default.yellow }, -- "sizeof", "+", "*", etc. Operator = { fg = c.default.yellow }, -- "sizeof", "+", "*", etc.
Keyword = { fg = c.default.yellow, bold = true }, -- any other keyword Keyword = { fg = c.default.yellow, bold = config.bold }, -- any other keyword
-- Exception = { }, -- try, catch, throw Exception = { fg = c.default.yellow, bold = config.bold }, -- try, catch, throw
PreProc = { fg = c.default.quartz }, -- (preferred) generic Preprocessor PreProc = { fg = c.default.quartz }, -- (preferred) generic Preprocessor
-- Include = { }, -- preprocessor #include Include = { fg = c.default.quartz }, -- preprocessor #include
-- Define = { }, -- preprocessor #define Define = { fg = c.default.quartz }, -- preprocessor #define
-- Macro = { }, -- same as Define Macro = { fg = c.default.quartz }, -- same as Define
-- PreCondit = { }, -- preprocessor #if, #else, #endif, etc. PreCondit = { fg = c.default.quartz }, -- preprocessor #if, #else, #endif, etc.
Type = { fg = c.default.quartz }, -- (preferred) int, long, char, etc. Type = { fg = c.default.quartz }, -- (preferred) int, long, char, etc.
-- StorageClass = { }, -- static, register, volatile, etc. StorageClass = { fg = c.default.yellow, bold = config.bold }, -- static, register, volatile, etc.
-- Structure = { }, -- struct, union, enum, etc. Structure = { fg = c.default.yellow, bold = config.bold }, -- struct, union, enum, etc.
-- Typedef = { }, -- A typedef Typedef = { fg = c.default.yellow, bold = config.bold }, -- A typedef
Special = { fg = c.default.yellow }, -- (preferred) any special symbol Special = { fg = c.default.yellow }, -- (preferred) any special symbol
-- SpecialChar = { }, -- special character in a constant -- SpecialChar = { }, -- special character in a constant
@ -108,9 +109,9 @@ M.groups = {
-- SpecialComment= { }, -- special things inside a comment -- SpecialComment= { }, -- special things inside a comment
-- Debug = { fg = c.default["fg+2"] }, -- debugging statements -- Debug = { fg = c.default["fg+2"] }, -- debugging statements
Underlined = { underline = true }, -- (preferred) text that stands out, HTML links Underlined = { underline = config.underline }, -- (preferred) text that stands out, HTML links
Bold = { bold = true }, Bold = { bold = config.bold },
Italic = { italic = true }, Italic = { italic = config.italic },
-- ("Ignore", below, may be invisible...) -- ("Ignore", below, may be invisible...)
-- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore|
@ -118,15 +119,15 @@ M.groups = {
-- Error = { fg = c.error }, -- (preferred) any erroneous construct -- Error = { fg = c.error }, -- (preferred) any erroneous construct
Todo = { fg = c.default.bg, bg = c.default.yellow }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX Todo = { fg = c.default.bg, bg = c.default.yellow }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX
markdownHeadingDelimiter = { fg = c.default.niagara, bold = true }, markdownHeadingDelimiter = { fg = c.default.niagara, bold = config.bold },
markdownCode = { fg = c.default.green }, markdownCode = { fg = c.default.green },
markdownCodeBlock = { fg = c.default.green }, markdownCodeBlock = { fg = c.default.green },
-- markdownH1 = { fg = c.magenta, bold = true }, -- markdownH1 = { fg = c.magenta, bold = true },
-- markdownH2 = { fg = c.blue, bold = true }, -- markdownH2 = { fg = c.blue, bold = true },
-- markdownLinkText = { fg = c.blue, underline = true }, -- markdownLinkText = { fg = c.blue, underline = true },
markdownItalic = { fg = c.default.wisteria, italic = true }, markdownItalic = { fg = c.default.wisteria, italic = config.italic },
markdownBold = { fg = c.default.yellow, bold = true }, markdownBold = { fg = c.default.yellow, bold = config.bold },
markdownCodeDelimiter = { fg = c.default.brown, italic = true }, markdownCodeDelimiter = { fg = c.default.brown, italic = config.italic },
markdownError = { fg = c.default.fg, bg = c.default["bg+1"] }, markdownError = { fg = c.default.fg, bg = c.default["bg+1"] },
-- These groups are for the neovim tree-sitter highlights. -- These groups are for the neovim tree-sitter highlights.
@ -189,7 +190,7 @@ M.groups = {
-- TSStrike = { }, -- For strikethrough text. -- TSStrike = { }, -- For strikethrough text.
-- TSTitle = { }, -- Text that is part of a title. -- TSTitle = { }, -- Text that is part of a title.
-- TSLiteral = { }, -- Literal text. -- TSLiteral = { }, -- Literal text.
TSURI = { fg = c.default.niagara, underline = true }, -- Any URI like a link or email. TSURI = { fg = c.default.niagara, underline = config.underline }, -- Any URI like a link or email.
["@text.diff.add"] = { link = "DiffAdd" }, ["@text.diff.add"] = { link = "DiffAdd" },
["@text.diff.delete"] = { link = "DiffDelete" }, ["@text.diff.delete"] = { link = "DiffDelete" },
["@text.diff.change"] = { link = "DiffChange" }, ["@text.diff.change"] = { link = "DiffChange" },

View File

@ -1,4 +1,3 @@
local highlights = require("gruber-darker.hl")
local config = require("gruber-darker.config") local config = require("gruber-darker.config")
local M = {} local M = {}
@ -7,58 +6,51 @@ local M = {}
---theme changes to something else ---theme changes to something else
---@package ---@package
function M.on_colorscheme() function M.on_colorscheme()
vim.cmd([[autocmd! GruberDarker]]) vim.cmd([[autocmd! GruberDarker]])
vim.cmd([[augroup! GruberDarker]]) vim.cmd([[augroup! GruberDarker]])
end end
---Clear current highlights and set Neovim global `colors_name` ---Clear current highlights and set Neovim global `colors_name`
local function prepare_env() function M.load()
if vim.g.colors_name then if vim.g.colors_name then
vim.cmd.hi("clear") vim.cmd.hi("clear")
end end
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.g.colors_name = "GruberDarker" vim.g.colors_name = "GruberDarker"
-- set highlights here...
local highlights = require("gruber-darker.hl")
for group, hl in pairs(highlights.groups) do
vim.api.nvim_set_hl(0, group, hl)
end
local gruber_darker_group = vim.api.nvim_create_augroup("GruberDarker", { clear = true })
vim.api.nvim_create_autocmd("ColorSchemePre", {
group = gruber_darker_group,
pattern = "*",
callback = function()
require("gruber-darker").on_colorscheme()
end,
})
-- vim.api.nvim_create_autocmd("FileType", {
-- group = gruber_darker_group,
-- pattern = "qf,help",
-- callback = function()
-- vim.cmd.setlocal("winhighlight=Normal:NormalSB,SignColumn:SignColumnSB")
-- end,
-- })
end end
---Change colorscheme to GruberDarker ---Change colorscheme to GruberDarker
function M.colorsheme() end function M.colorscheme()
end
---GruberDarker configuration bootstrapper ---GruberDarker configuration bootstrapper
---@param opts Options ---@param opts Options
function M.setup(opts) function M.setup(opts)
config.set(opts or {}) config.set(opts or {})
opts = config.get_resolved_opts()
-- print("message: " .. opts.message)
prepare_env()
-- set highlights here...
for group, hl in pairs(highlights.groups) do
vim.api.nvim_set_hl(0, group, hl)
end
local gruber_darker_group = vim.api.nvim_create_augroup("GruberDarker", { clear = true })
vim.api.nvim_create_autocmd("ColorSchemePre", {
group = gruber_darker_group,
pattern = "*",
callback = function()
require("gruber-darker").on_colorscheme()
end,
})
-- vim.api.nvim_create_autocmd("FileType", {
-- group = gruber_darker_group,
-- pattern = "qf,help",
-- callback = function()
-- vim.cmd.setlocal("winhighlight=Normal:NormalSB,SignColumn:SignColumnSB")
-- end,
-- })
end end
-- M.setup({
-- message = "Test message ensuring when a user calls "
-- .. "`setup` with overrides, their preferences are kept.",
-- })
return M return M