Add option to disable italic styling

This commit is contained in:
Webhooked
2025-05-07 11:49:57 +02:00
parent 921f85c99a
commit 6d7770eda6
5 changed files with 13 additions and 8 deletions
+2 -1
View File
@@ -81,6 +81,7 @@ require('kanso').setup({
keywordStyle = { italic = true}, keywordStyle = { italic = true},
statementStyle = {}, statementStyle = {},
typeStyle = {}, typeStyle = {},
disableItalics = false,
transparent = false, -- do not set background color transparent = false, -- do not set background color
dimInactive = false, -- dim inactive window `:h hl-NormalNC` dimInactive = false, -- dim inactive window `:h hl-NormalNC`
terminalColors = true, -- define vim.g.terminal_color_{0,17} terminalColors = true, -- define vim.g.terminal_color_{0,17}
@@ -233,7 +234,7 @@ require('kanso').setup({
overrides = function(colors) overrides = function(colors)
return { return {
-- Assign a static color to strings -- Assign a static color to strings
String = { fg = colors.palette.carpYellow, italic = true }, String = { fg = colors.palette.carpYellow, italic = not config.disableItalics },
-- theme colors will update dynamically when you change theme! -- theme colors will update dynamically when you change theme!
SomePluginHl = { fg = colors.theme.syn.type, bold = true }, SomePluginHl = { fg = colors.theme.syn.type, bold = true },
} }
+2 -2
View File
@@ -62,7 +62,7 @@ function M.setup(colors, config)
NvimTreeSymlink = { link = "Type" }, NvimTreeSymlink = { link = "Type" },
NvimTreeFolderName = { link = "Directory" }, NvimTreeFolderName = { link = "Directory" },
NvimTreeExecFile = { fg = theme.syn.string, bold = true }, NvimTreeExecFile = { fg = theme.syn.string, bold = true },
NvimTreeOpenedFile = { fg = theme.syn.special1, italic = true }, NvimTreeOpenedFile = { fg = theme.syn.special1, italic = not config.disableItalics },
NvimTreeWinSeparator = { link = "WinSeparator" }, NvimTreeWinSeparator = { link = "WinSeparator" },
NvimTreeWindowPicker = { bg = theme.ui.bg_m1, fg = theme.syn.special1, bold = true }, NvimTreeWindowPicker = { bg = theme.ui.bg_m1, fg = theme.syn.special1, bold = true },
-- NeoTree -- NeoTree
@@ -456,7 +456,7 @@ function M.setup(colors, config)
NeotestFile = { fg = theme.syn.fun, }, NeotestFile = { fg = theme.syn.fun, },
NeotestFocused = { bold = true, underline = true, }, NeotestFocused = { bold = true, underline = true, },
NeotestIndent = { fg = theme.ui.special, bold = true, }, NeotestIndent = { fg = theme.ui.special, bold = true, },
NeotestMarked = { fg = theme.diag.warning, italic = true, }, NeotestMarked = { fg = theme.diag.warning, italic = not config.disableItalics, },
NeotestNamespace = { fg = theme.syn.fun, }, NeotestNamespace = { fg = theme.syn.fun, },
NeotestPassed = { fg = theme.diag.ok }, NeotestPassed = { fg = theme.diag.ok },
NeotestRunning = { fg = theme.vcs.changed, }, NeotestRunning = { fg = theme.vcs.changed, },
+5 -3
View File
@@ -9,7 +9,8 @@ function M.setup(colors, config)
return { return {
-- *Comment any comment -- *Comment any comment
Comment = vim.tbl_extend("force", { fg = theme.syn.comment }, config.commentStyle), Comment = vim.tbl_extend("force", { fg = theme.syn.comment }, config.disableItalics and {} or config
.commentStyle),
-- *Constant any constant -- *Constant any constant
Constant = { fg = theme.syn.constant }, Constant = { fg = theme.syn.constant },
@@ -37,7 +38,8 @@ function M.setup(colors, config)
-- Operator "sizeof", "+", "*", etc. -- Operator "sizeof", "+", "*", etc.
Operator = { fg = theme.syn.operator }, Operator = { fg = theme.syn.operator },
-- Keyword any other keyword -- Keyword any other keyword
Keyword = vim.tbl_extend("force", { fg = theme.syn.keyword }, config.keywordStyle), Keyword = vim.tbl_extend("force", { fg = theme.syn.keyword }, config.disableItalics and {} or config
.keywordStyle),
-- Exception try, catch, throw -- Exception try, catch, throw
Exception = { fg = theme.syn.special2 }, Exception = { fg = theme.syn.special2 },
@@ -66,7 +68,7 @@ function M.setup(colors, config)
-- *Underlined text that stands out, HTML links -- *Underlined text that stands out, HTML links
Underlined = { fg = theme.syn.special1, underline = true }, Underlined = { fg = theme.syn.special1, underline = true },
Bold = { bold = true }, Bold = { bold = true },
Italic = { italic = true }, Italic = { italic = not config.disableItalics },
-- *Ignore left blank, hidden |hl-Ignore| -- *Ignore left blank, hidden |hl-Ignore|
Ignore = { link = "NonText" }, Ignore = { link = "NonText" },
+3 -2
View File
@@ -9,7 +9,7 @@ function M.setup(colors, config)
-- @variable various variable names -- @variable various variable names
["@variable"] = { fg = theme.ui.fg }, ["@variable"] = { fg = theme.ui.fg },
-- @variable.builtin (Special) built-in variable names (e.g. `this`, `self`) -- @variable.builtin (Special) built-in variable names (e.g. `this`, `self`)
["@variable.builtin"] = { fg = theme.syn.special2, italic = true }, ["@variable.builtin"] = { fg = theme.syn.special2, italic = not config.disableItalics },
-- @variable.parameter parameters of a function -- @variable.parameter parameters of a function
["@variable.parameter"] = { fg = theme.syn.parameter }, ["@variable.parameter"] = { fg = theme.syn.parameter },
-- @variable.parameter.builtin special parameters (e.g. `_`, `it`) -- @variable.parameter.builtin special parameters (e.g. `_`, `it`)
@@ -77,7 +77,8 @@ function M.setup(colors, config)
-- @keyword.modifier keywords defining type modifiers (e.g. `const`, `static`, `public`) -- @keyword.modifier keywords defining type modifiers (e.g. `const`, `static`, `public`)
-- @keyword.repeat keywords related to loops (e.g. `for`, `while`) -- @keyword.repeat keywords related to loops (e.g. `for`, `while`)
-- @keyword.return keywords like `return` and `yield` -- @keyword.return keywords like `return` and `yield`
["@keyword.return"] = vim.tbl_extend("force", { fg = theme.syn.special3 }, config.keywordStyle), ["@keyword.return"] = vim.tbl_extend("force", { fg = theme.syn.special3 },
config.disableItalics and {} or config.keywordStyle),
-- @keyword.debug keywords related to debugging -- @keyword.debug keywords related to debugging
-- @keyword.exception keywords related to exceptions (e.g. `throw`, `catch`) -- @keyword.exception keywords related to exceptions (e.g. `throw`, `catch`)
["@keyword.exception"] = vim.tbl_extend("force", { fg = theme.syn.special3 }, config.statementStyle), ["@keyword.exception"] = vim.tbl_extend("force", { fg = theme.syn.special3 }, config.statementStyle),
+1
View File
@@ -17,6 +17,7 @@ M.config = {
transparent = false, transparent = false,
dimInactive = false, dimInactive = false,
terminalColors = true, terminalColors = true,
disableItalics = false,
colors = { theme = { zen = {}, pearl = {}, ink = {}, all = {} }, palette = {} }, colors = { theme = { zen = {}, pearl = {}, ink = {}, all = {} }, palette = {} },
---@type fun(colors: KansoColorsSpec): table<string, table> ---@type fun(colors: KansoColorsSpec): table<string, table>
overrides = function() overrides = function()