feat: update config, docs, and add italics to more groups

This commit is contained in:
Daniel Hill 2023-03-26 10:03:06 -04:00
parent 8e828749cd
commit 58715dc627
4 changed files with 68 additions and 35 deletions

View File

@ -7,7 +7,7 @@ _A modern Neovim port of a deftheme [adaptation][gruber-darker-theme] of an Emac
## Installation ## Installation
### Lazy ### Lazy (recommended)
```lua ```lua
{ "blazkowolf/gruber-darker.nvim" } { "blazkowolf/gruber-darker.nvim" }
@ -25,7 +25,7 @@ use "blazkowolf/gruber-darker.nvim"
Plug 'blazkowolf/gruber-darker.nvim' 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
```lua ```lua
vim.cmd.colorscheme("GruberDarker") vim.cmd.colorscheme("GruberDarker")
@ -33,17 +33,39 @@ vim.cmd.colorscheme("GruberDarker")
## Configuration ## Configuration
Configuration options can be changed by calling `setup()` ### Defaults
with your preferences prior to loading the colorscheme.
```lua ```lua
-- Config defaults {
require("gruber-darker").setup({ bold = true,
bold = true, italic = {
italic = true, strings = true,
underline = true, comments = true,
comment_italics = true, operators = false,
}) folds = true,
},
underline = true,
}
```
### With updated preferences
Change configuration options by calling `setup()`
prior to loading the colorscheme. Your preferences
will be merged with the defaults.
```lua
{
"blazkowolf/gruber-darker.nvim",
config = function()
require("gruber-darker").setup({
bold = false,
italic = {
strings = false,
},
})
end
}
``` ```
## Credits ## Credits

View File

@ -1,15 +1,26 @@
---@alias ItalicType
---|"strings"
---|"comments"
---|"operators"
---|"folds"
---@class GruberDarkerOpts ---@class GruberDarkerOpts
---@field bold boolean ---@field bold boolean
---@field italic boolean ---@field italic table<ItalicType, boolean>
---@field undercurl boolean
---@field underline boolean ---@field underline boolean
---@field comment_italics boolean
---@type GruberDarkerOpts ---@type GruberDarkerOpts
local DEFAULTS = { local DEFAULTS = {
bold = true, bold = true,
italic = true, italic = {
strings = true,
comments = true,
operators = false,
folds = true,
},
-- undercurl = true,
underline = true, underline = true,
comment_italics = true,
} }
---@class ConfigMgr ---@class ConfigMgr

View File

@ -1,6 +1,6 @@
local c = require("gruber-darker.palette") local c = require("gruber-darker.palette")
local opts = require("gruber-darker.config").get_opts() local opts = require("gruber-darker.config").get_opts()
local vim_hl = require("gruber-darker.highlights.vim") local vim_hl = require("gruber-darker.highlights.vim").highlights
local Highlight = require("gruber-darker.highlight") local Highlight = require("gruber-darker.highlight")
local M = { local M = {
@ -24,8 +24,8 @@ end
-- TSAnnotation = Highlight.new("", { }) -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. -- TSAnnotation = Highlight.new("", { }) -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
-- TSAttribute = Highlight.new("", { }) -- (unstable) TODO: docs -- TSAttribute = Highlight.new("", { }) -- (unstable) TODO: docs
M.highlights.boolean = Highlight.new("TSBoolean", { fg = c.default.quartz }) -- For booleans. M.highlights.boolean = Highlight.new("TSBoolean", { fg = c.default.quartz }) -- For booleans.
M.highlights.character = Highlight.new("TSCharacter", { fg = c.default.green }) -- For characters. M.highlights.character = Highlight.new("TSCharacter", { link = vim_hl.character }) -- For characters.
M.highlights.comment = Highlight.new("TSComment", { fg = c.default.brown }) -- For comment blocks. M.highlights.comment = Highlight.new("TSComment", { link = vim_hl.comment }) -- For comment blocks.
-- TSNote = Highlight.new("TSNote", { fg = c.bg, bg = c.info }) -- TSNote = Highlight.new("TSNote", { fg = c.bg, bg = c.info })
M.highlights.text_warning = Highlight.new("@text.warning", { fg = c.default.red }) M.highlights.text_warning = Highlight.new("@text.warning", { fg = c.default.red })
M.highlights.text_danger = Highlight.new("@text.danger", { fg = c.default.white, bg = c.default.red }) M.highlights.text_danger = Highlight.new("@text.danger", { fg = c.default.white, bg = c.default.red })
@ -58,9 +58,9 @@ M.highlights.constant = Highlight.new("TSConstant", { fg = c.default.quartz }) -
-- ["@punctuation.special"] = Highlight.new("", { fg = c.blue5 }) -- For special punctutation that does not fall in the catagories before. -- ["@punctuation.special"] = Highlight.new("", { fg = c.blue5 }) -- For special punctutation that does not fall in the catagories before.
-- For keywords related to loops. -- For keywords related to loops.
M.highlights.repeats = Highlight.new("TSRepeat", { fg = c.default.yellow }) M.highlights.repeats = Highlight.new("TSRepeat", { link = vim_hl.repeats })
-- For strings. -- For strings.
M.highlights.string = Highlight.new("TSString", { fg = c.default.green }) M.highlights.string = Highlight.new("TSString", { link = vim_hl.string })
-- ["@string.regex"] = Highlight.new("", { fg = c.blue6 }) -- For regexes. -- ["@string.regex"] = Highlight.new("", { fg = c.blue6 }) -- For regexes.
-- ["@string.escape"] = Highlight.new("", { fg = c.magenta }) -- For escape characters within a string. -- ["@string.escape"] = Highlight.new("", { fg = c.magenta }) -- For escape characters within a string.
-- TSSymbol = Highlight.new("", { }) -- For identifiers referring to symbols or atoms. -- TSSymbol = Highlight.new("", { }) -- For identifiers referring to symbols or atoms.
@ -84,8 +84,8 @@ M.highlights.type = Highlight.new("TSType", { fg = c.default.quartz })
---Any URI like a link or email. ---Any URI like a link or email.
M.highlights.uri = Highlight.new("TSURI", { fg = c.default.niagara, underline = opts.underline }) M.highlights.uri = Highlight.new("TSURI", { fg = c.default.niagara, underline = opts.underline })
M.highlights.text_diff_add = Highlight.new("@text.diff.add", { link = vim_hl.highlights.diff_add }) M.highlights.text_diff_add = Highlight.new("@text.diff.add", { link = vim_hl.diff_add })
M.highlights.text_diff_delete = Highlight.new("@text.diff.delete", { link = vim_hl.highlights.diff_delete }) M.highlights.text_diff_delete = Highlight.new("@text.diff.delete", { link = vim_hl.diff_delete })
M.highlights.text_diff_change = Highlight.new("@text.diff.change", { link = vim_hl.highlights.diff_change }) M.highlights.text_diff_change = Highlight.new("@text.diff.change", { link = vim_hl.diff_change })
return M return M

View File

@ -16,7 +16,7 @@ end
---any comment ---any comment
M.highlights.comment = M.highlights.comment =
Highlight.new("Comment", { fg = c.default.brown, italic = opts.comment_italics and opts.italic }) Highlight.new("Comment", { fg = c.default.brown, italic = opts.italic.comments })
---used for the columns set with 'colorcolumn' ---used for the columns set with 'colorcolumn'
M.highlights.color_column = Highlight.new("ColorColumn", { bg = c.default["bg+2"] }) M.highlights.color_column = Highlight.new("ColorColumn", { bg = c.default["bg+2"] })
---placeholder characters substituted for concealed text (see 'conceallevel') ---placeholder characters substituted for concealed text (see 'conceallevel')
@ -42,7 +42,7 @@ M.highlights.diff_delete = Highlight.new("DiffDelete", { fg = c.default["red+1"]
---diff mode: Changed text within a changed line |diff.txt| ---diff mode: Changed text within a changed line |diff.txt|
M.highlights.diff_text = Highlight.new("DiffText", { fg = c.default.yellow, bg = c.default.none }) M.highlights.diff_text = Highlight.new("DiffText", { fg = c.default.yellow, bg = c.default.none })
---filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. ---filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
M.highlights.end_of_buffer = Highlight.new("EndOfBuffer", { fg = c.default.fg, bg = c.default.bg }) M.highlights.end_of_buffer = Highlight.new("EndOfBuffer", { fg = c.default["bg+4"], bg = c.default.none })
---cursor in a focused terminal ---cursor in a focused terminal
M.highlights.term_cursor = Highlight.new("TermCursor", { bg = c.default.yellow }) M.highlights.term_cursor = Highlight.new("TermCursor", { bg = c.default.yellow })
---TermCursorNC= { }, ---cursor in an unfocused terminal ---TermCursorNC= { }, ---cursor in an unfocused terminal
@ -54,7 +54,7 @@ M.highlights.vert_split = Highlight.new("VertSplit", { fg = c.default["fg+2"], b
---the column separating vertically split windows ---the column separating vertically split windows
M.highlights.win_separator = Highlight.new("WinSeparator", { fg = c.default["bg+2"], bold = opts.bold }) M.highlights.win_separator = Highlight.new("WinSeparator", { fg = c.default["bg+2"], bold = opts.bold })
---line used for closed folds ---line used for closed folds
M.highlights.folded = Highlight.new("Folded", { fg = c.default.brown, bg = c.default["fg+2"], italic = true }) M.highlights.folded = Highlight.new("Folded", { fg = c.default.brown, bg = c.default["fg+2"], italic = opts.italic.folds })
---'foldcolumn' ---'foldcolumn'
M.highlights.fold_column = Highlight.new("FoldColumn", { fg = c.default.brown, bg = c.default["fg+2"] }) M.highlights.fold_column = Highlight.new("FoldColumn", { fg = c.default.brown, bg = c.default["fg+2"] })
---column where |signs| are displayed ---column where |signs| are displayed
@ -78,9 +78,9 @@ M.highlights.non_text = Highlight.new("NonText", { fg = c.default["fg+2"] })
---normal text ---normal text
M.highlights.normal = Highlight.new("Normal", { fg = c.default.fg, bg = c.default.bg }) M.highlights.normal = Highlight.new("Normal", { fg = c.default.fg, bg = c.default.bg })
---normal text in non-current windows ---normal text in non-current windows
M.highlights.normal_non_current = Highlight.new("NormalNC", { fg = c.default.fg, bg = c.default.bg }) M.highlights.normal_non_current = Highlight.new("NormalNC", { fg = c.default.fg, bg = c.default["bg-1"] })
---normal text in sidebar ---normal text in sidebar
M.highlights.normal_sidebar = Highlight.new("NormalSB", { fg = c.default.fg, bg = c.default.bg }) M.highlights.normal_sidebar = Highlight.new("NormalSB", { fg = c.default.fg, bg = c.default["bg-1"] })
---Normal text in floating windows. ---Normal text in floating windows.
M.highlights.normal_float = Highlight.new("NormalFloat", { fg = c.default.fg, bg = c.default.bg }) M.highlights.normal_float = Highlight.new("NormalFloat", { fg = c.default.fg, bg = c.default.bg })
M.highlights.float_border = Highlight.new("FloatBorder", { fg = c.default["bg+2"], bg = c.default["bg-1"] }) M.highlights.float_border = Highlight.new("FloatBorder", { fg = c.default["bg+2"], bg = c.default["bg-1"] })
@ -143,9 +143,9 @@ M.highlights.wild_menu = Highlight.new("WildMenu", { fg = c.default.black, bg =
---(preferred) any constant ---(preferred) any constant
M.highlights.constant = Highlight.new("Constant", { fg = c.default.quartz }) M.highlights.constant = Highlight.new("Constant", { fg = c.default.quartz })
--- a string constant: "this is a string" --- a string constant: "this is a string"
M.highlights.string = Highlight.new("String", { fg = c.default.green }) M.highlights.string = Highlight.new("String", { fg = c.default.green, italic = opts.italic.strings })
--- a character constant: 'c', '\n' --- a character constant: 'c', '\n'
M.highlights.character = Highlight.new("Character", { fg = c.default.green }) M.highlights.character = Highlight.new("Character", { fg = c.default.green, italic = opts.italic.strings })
--- a number constant: 234, 0xff --- a number constant: 234, 0xff
M.highlights.number = Highlight.new("Number", { fg = c.default.fg }) M.highlights.number = Highlight.new("Number", { fg = c.default.fg })
--- a boolean constant: TRUE, false --- a boolean constant: TRUE, false
@ -165,7 +165,7 @@ M.highlights.repeats = Highlight.new("Repeat", { fg = c.default.yellow, bold = o
---case, default, etc. ---case, default, etc.
M.highlights.label = Highlight.new("Label", { fg = c.default.yellow, bold = opts.bold }) M.highlights.label = Highlight.new("Label", { fg = c.default.yellow, bold = opts.bold })
---"sizeof", "+", "*", etc. ---"sizeof", "+", "*", etc.
M.highlights.operator = Highlight.new("Operator", { fg = c.default.yellow }) M.highlights.operator = Highlight.new("Operator", { fg = c.default.yellow, italic = opts.italic.operators })
---any other keyword ---any other keyword
M.highlights.keyword = Highlight.new("Keyword", { fg = c.default.yellow, bold = opts.bold }) M.highlights.keyword = Highlight.new("Keyword", { fg = c.default.yellow, bold = opts.bold })
---try, catch, throw ---try, catch, throw
@ -198,8 +198,8 @@ M.highlights.special = Highlight.new("Special", { fg = c.default.yellow })
---(preferred) text that stands out, HTML links ---(preferred) text that stands out, HTML links
M.highlights.underlined = Highlight.new("Underlined", { underline = opts.underline }) M.highlights.underlined = Highlight.new("Underlined", { underline = opts.underline })
M.highlights.bold = Highlight.new("Bold", { bold = opts.bold }) M.highlights.bold = Highlight.new("Bold", { bold = true })
M.highlights.italic = Highlight.new("Italic", { italic = opts.italic }) M.highlights.italic = Highlight.new("Italic", { italic = true })
---("Ignore", below, may be invisible...) ---("Ignore", below, may be invisible...)
---Ignore = Highlight.new("Ignore", { }) ---(preferred) left blank, hidden |hl-Ignore| ---Ignore = Highlight.new("Ignore", { }) ---(preferred) left blank, hidden |hl-Ignore|
@ -214,10 +214,10 @@ M.highlights.md_code_block = Highlight.new("markdownCodeBlock", { fg = c.default
---markdownH1 = Highlight.new("markdownH1", { fg = c.magenta, bold = true }) ---markdownH1 = Highlight.new("markdownH1", { fg = c.magenta, bold = true })
---markdownH2 = Highlight.new("markdownH2", { fg = c.blue, bold = true }) ---markdownH2 = Highlight.new("markdownH2", { fg = c.blue, bold = true })
---markdownLinkText = Highlight.new("markdownLinkText", { fg = c.blue, underline = true }) ---markdownLinkText = Highlight.new("markdownLinkText", { fg = c.blue, underline = true })
M.highlights.md_italic = Highlight.new("markdownItalic", { fg = c.default.wisteria, italic = opts.italic }) M.highlights.md_italic = Highlight.new("markdownItalic", { fg = c.default.wisteria, italic = true })
M.highlights.md_bold = Highlight.new("markdownBold", { fg = c.default.yellow, bold = opts.bold }) M.highlights.md_bold = Highlight.new("markdownBold", { fg = c.default.yellow, bold = opts.bold })
M.highlights.md_code_delim = M.highlights.md_code_delim =
Highlight.new("markdownCodeDelimiter", { fg = c.default.brown, italic = opts.italic }) Highlight.new("markdownCodeDelimiter", { fg = c.default.brown, italic = true })
M.highlights.md_error = Highlight.new("markdownError", { fg = c.default.fg, bg = c.default["bg+1"] }) M.highlights.md_error = Highlight.new("markdownError", { fg = c.default.fg, bg = c.default["bg+1"] })
return M return M