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
### Lazy
### Lazy (recommended)
```lua
{ "blazkowolf/gruber-darker.nvim" }
@ -25,7 +25,7 @@ use "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
vim.cmd.colorscheme("GruberDarker")
@ -33,17 +33,39 @@ vim.cmd.colorscheme("GruberDarker")
## Configuration
Configuration options can be changed by calling `setup()`
with your preferences prior to loading the colorscheme.
### Defaults
```lua
-- Config defaults
require("gruber-darker").setup({
bold = true,
italic = true,
underline = true,
comment_italics = true,
})
{
bold = true,
italic = {
strings = true,
comments = 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

View File

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

View File

@ -1,6 +1,6 @@
local c = require("gruber-darker.palette")
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 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.
-- TSAttribute = Highlight.new("", { }) -- (unstable) TODO: docs
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.comment = Highlight.new("TSComment", { fg = c.default.brown }) -- For comment blocks.
M.highlights.character = Highlight.new("TSCharacter", { link = vim_hl.character }) -- For characters.
M.highlights.comment = Highlight.new("TSComment", { link = vim_hl.comment }) -- For comment blocks.
-- 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_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.
-- 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.
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.escape"] = Highlight.new("", { fg = c.magenta }) -- For escape characters within a string.
-- 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.
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_delete = Highlight.new("@text.diff.delete", { link = vim_hl.highlights.diff_delete })
M.highlights.text_diff_change = Highlight.new("@text.diff.change", { link = vim_hl.highlights.diff_change })
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.diff_delete })
M.highlights.text_diff_change = Highlight.new("@text.diff.change", { link = vim_hl.diff_change })
return M

View File

@ -16,7 +16,7 @@ end
---any 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'
M.highlights.color_column = Highlight.new("ColorColumn", { bg = c.default["bg+2"] })
---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|
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|.
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
M.highlights.term_cursor = Highlight.new("TermCursor", { bg = c.default.yellow })
---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
M.highlights.win_separator = Highlight.new("WinSeparator", { fg = c.default["bg+2"], bold = opts.bold })
---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'
M.highlights.fold_column = Highlight.new("FoldColumn", { fg = c.default.brown, bg = c.default["fg+2"] })
---column where |signs| are displayed
@ -78,9 +78,9 @@ M.highlights.non_text = Highlight.new("NonText", { fg = c.default["fg+2"] })
---normal text
M.highlights.normal = Highlight.new("Normal", { fg = c.default.fg, bg = c.default.bg })
---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
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.
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"] })
@ -143,9 +143,9 @@ M.highlights.wild_menu = Highlight.new("WildMenu", { fg = c.default.black, bg =
---(preferred) any constant
M.highlights.constant = Highlight.new("Constant", { fg = c.default.quartz })
--- 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'
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
M.highlights.number = Highlight.new("Number", { fg = c.default.fg })
--- a boolean constant: TRUE, false
@ -165,7 +165,7 @@ M.highlights.repeats = Highlight.new("Repeat", { fg = c.default.yellow, bold = o
---case, default, etc.
M.highlights.label = Highlight.new("Label", { fg = c.default.yellow, bold = opts.bold })
---"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
M.highlights.keyword = Highlight.new("Keyword", { fg = c.default.yellow, bold = opts.bold })
---try, catch, throw
@ -198,8 +198,8 @@ M.highlights.special = Highlight.new("Special", { fg = c.default.yellow })
---(preferred) text that stands out, HTML links
M.highlights.underlined = Highlight.new("Underlined", { underline = opts.underline })
M.highlights.bold = Highlight.new("Bold", { bold = opts.bold })
M.highlights.italic = Highlight.new("Italic", { italic = opts.italic })
M.highlights.bold = Highlight.new("Bold", { bold = true })
M.highlights.italic = Highlight.new("Italic", { italic = true })
---("Ignore", below, may be invisible...)
---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 })
---markdownH2 = Highlight.new("markdownH2", { fg = c.blue, bold = 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_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"] })
return M