BREAKING CHANGE: rename "contrast" to "saturated" throughout codebase

This change renames all occurrences of "contrast" to "saturated" to better describe the functionality:
- Config option `foreground` now accepts "saturated" instead of "contrast"
- All internal color palette variables renamed from *Contrast to *Saturated
- Documentation updated to reflect the new terminology

Migration guide:
- If using `foreground = "contrast"`, change to `foreground = "saturated"`
- If using `foreground = { dark = "contrast", light = "contrast" }`, change to `foreground = { dark = "saturated", light = "saturated" }`
This commit is contained in:
Webhooked 2025-07-28 09:33:50 +02:00
commit d1ba9eaf7c
4 changed files with 115 additions and 115 deletions

View file

@ -57,29 +57,29 @@ local palette = {
orange2 = "#b98d7b",
aqua = "#8ea4a2",
-- Contrast variants (20% more saturation)
redContrast = "#C93134",
red2Contrast = "#ED5965",
red3Contrast = "#CA675F",
yellowContrast = "#E59F49",
yellow2Contrast = "#EDC272",
yellow3Contrast = "#CAAC7A",
greenContrast = "#8FC055",
green2Contrast = "#7CAF7C",
green3Contrast = "#7F9F6E",
green4Contrast = "#5B9A82",
green5Contrast = "#6BAE97",
blueContrast = "#6EBBD4",
blue2Contrast = "#568B8F",
blue3Contrast = "#7EAABA",
blue4Contrast = "#81AAA9",
violetContrast = "#8A88B0",
violet2Contrast = "#7E91AF",
violet3Contrast = "#8A9FBE",
pinkContrast = "#A08AA2",
orangeContrast = "#BC8A6C",
orange2Contrast = "#BF856B",
aquaContrast = "#81AAA9",
-- Saturated variants (20% more saturation)
redSaturated = "#C93134",
red2Saturated = "#ED5965",
red3Saturated = "#CA675F",
yellowSaturated = "#E59F49",
yellow2Saturated = "#EDC272",
yellow3Saturated = "#CAAC7A",
greenSaturated = "#8FC055",
green2Saturated = "#7CAF7C",
green3Saturated = "#7F9F6E",
green4Saturated = "#5B9A82",
green5Saturated = "#6BAE97",
blueSaturated = "#6EBBD4",
blue2Saturated = "#568B8F",
blue3Saturated = "#7EAABA",
blue4Saturated = "#81AAA9",
violetSaturated = "#8A88B0",
violet2Saturated = "#7E91AF",
violet3Saturated = "#8A9FBE",
pinkSaturated = "#A08AA2",
orangeSaturated = "#BC8A6C",
orange2Saturated = "#BF856B",
aquaSaturated = "#81AAA9",
-- Fg and Comments
fg = "#C5C9C7",
@ -133,29 +133,29 @@ local palette = {
pearlTeal3 = "#5a7785",
pearlCyan = "#d7e3d8",
-- Pearl contrast variants (40% more saturation)
pearlGreenContrast = "#5E8F2F",
pearlGreen2Contrast = "#5B9945",
pearlGreen3Contrast = "#A8DA9B",
pearlPinkContrast = "#C04062",
pearlOrangeContrast = "#E05700",
pearlOrange2Contrast = "#FF7700",
pearlYellowContrast = "#656720",
pearlYellow2Contrast = "#72612B",
pearlYellow3Contrast = "#F28C00",
pearlYellow4Contrast = "#FFD56D",
pearlRedContrast = "#D72436",
pearlRed2Contrast = "#E42D2C",
pearlRed3Contrast = "#F50000",
pearlRed4Contrast = "#E4977B",
pearlAquaContrast = "#3E8366",
pearlAqua2Contrast = "#428F6A",
pearlTeal1Contrast = "#2E96B0",
pearlTeal2Contrast = "#469FD3",
pearlTeal3Contrast = "#3D8077",
pearlBlue4Contrast = "#2A73B1",
pearlBlue5Contrast = "#3E56B8",
pearlViolet4Contrast = "#44418F",
-- Pearl saturated variants (40% more saturation)
pearlGreenSaturated = "#5E8F2F",
pearlGreen2Saturated = "#5B9945",
pearlGreen3Saturated = "#A8DA9B",
pearlPinkSaturated = "#C04062",
pearlOrangeSaturated = "#E05700",
pearlOrange2Saturated = "#FF7700",
pearlYellowSaturated = "#656720",
pearlYellow2Saturated = "#72612B",
pearlYellow3Saturated = "#F28C00",
pearlYellow4Saturated = "#FFD56D",
pearlRedSaturated = "#D72436",
pearlRed2Saturated = "#E42D2C",
pearlRed3Saturated = "#F50000",
pearlRed4Saturated = "#E4977B",
pearlAquaSaturated = "#3E8366",
pearlAqua2Saturated = "#428F6A",
pearlTeal1Saturated = "#2E96B0",
pearlTeal2Saturated = "#469FD3",
pearlTeal3Saturated = "#3D8077",
pearlBlue4Saturated = "#2A73B1",
pearlBlue5Saturated = "#3E56B8",
pearlViolet4Saturated = "#44418F",
}
local M = {}
@ -165,7 +165,7 @@ local M = {}
--- Defaults to KansoConfig.colors.
--- - theme: Use selected theme. Defaults to KansoConfig.theme
--- according to the value of 'background' option.
---@param opts? { colors?: table, theme?: string, foreground?: "default"|"contrast" }
---@param opts? { colors?: table, theme?: string, foreground?: "default"|"saturated" }
---@return { theme: ThemeColors, palette: PaletteColors}
function M.setup(opts)
opts = opts or {}
@ -188,7 +188,7 @@ function M.setup(opts)
or (type(kanso_config.foreground) == "table" and kanso_config.foreground[bg_mode])
or kanso_config.foreground
or "default"
---@cast foreground "default"|"contrast"
---@cast foreground "default"|"saturated"
local theme_colors = require("kanso.themes")[theme](updated_palette_colors, foreground)
-- Add to and/or override theme_colors

View file

@ -27,7 +27,7 @@ M.config = {
---@type { dark: string, light: string }
background = { dark = "ink", light = "pearl" },
theme = "ink",
---@type { dark: "default"|"contrast", light: "default"|"contrast" }|"default"|"contrast"
---@type { dark: "default"|"saturated", light: "default"|"saturated" }|"default"|"saturated"
foreground = "default",
compile = false,
}
@ -88,7 +88,7 @@ function M.load(theme)
else
local foreground_setting = type(M.config.foreground) == "table" and M.config.foreground[vim.o.background]
or M.config.foreground
---@cast foreground_setting "default"|"contrast"
---@cast foreground_setting "default"|"saturated"
local colors =
require("kanso.colors").setup({ theme = theme, colors = M.config.colors, foreground = foreground_setting })
local highlights = require("kanso.highlights").setup(colors, M.config)
@ -128,7 +128,7 @@ function M.compile()
else
-- Fallback for backward compatibility
local foreground_str = M.config.foreground
---@cast foreground_str "default"|"contrast"
---@cast foreground_str "default"|"saturated"
local colors = require("kanso.colors").setup({
theme = theme,
colors = M.config.colors,

View file

@ -92,7 +92,7 @@
return {
---@param palette PaletteColors
---@param foreground? "default"|"contrast"
---@param foreground? "default"|"saturated"
---@return ThemeColors
zen = function(palette, foreground)
return {
@ -142,25 +142,25 @@ return {
},
},
syn = {
string = foreground == "contrast" and palette.green3Contrast or palette.green3,
string = foreground == "saturated" and palette.green3Saturated or palette.green3,
variable = "NONE",
number = foreground == "contrast" and palette.pinkContrast or palette.pink,
constant = foreground == "contrast" and palette.orangeContrast or palette.orange,
identifier = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
number = foreground == "saturated" and palette.pinkSaturated or palette.pink,
constant = foreground == "saturated" and palette.orangeSaturated or palette.orange,
identifier = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
parameter = palette.gray3,
fun = foreground == "contrast" and palette.blue3Contrast or palette.blue3,
statement = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
keyword = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
fun = foreground == "saturated" and palette.blue3Saturated or palette.blue3,
statement = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
keyword = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
operator = palette.gray3,
preproc = palette.gray3,
type = foreground == "contrast" and palette.aquaContrast or palette.aqua,
regex = foreground == "contrast" and palette.red3Contrast or palette.red3,
type = foreground == "saturated" and palette.aquaSaturated or palette.aqua,
regex = foreground == "saturated" and palette.red3Saturated or palette.red3,
deprecated = palette.gray,
punct = palette.gray3,
comment = palette.gray4,
special1 = foreground == "contrast" and palette.yellow3Contrast or palette.yellow3,
special2 = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
special3 = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
special1 = foreground == "saturated" and palette.yellow3Saturated or palette.yellow3,
special2 = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
special3 = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
},
diag = {
error = palette.red,
@ -204,7 +204,7 @@ return {
}
end,
---@param palette PaletteColors
---@param foreground? "default"|"contrast"
---@param foreground? "default"|"saturated"
---@return ThemeColors
ink = function(palette, foreground)
return {
@ -254,25 +254,25 @@ return {
},
},
syn = {
string = foreground == "contrast" and palette.green3Contrast or palette.green3,
string = foreground == "saturated" and palette.green3Saturated or palette.green3,
variable = "NONE",
number = foreground == "contrast" and palette.pinkContrast or palette.pink,
constant = foreground == "contrast" and palette.orangeContrast or palette.orange,
identifier = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
number = foreground == "saturated" and palette.pinkSaturated or palette.pink,
constant = foreground == "saturated" and palette.orangeSaturated or palette.orange,
identifier = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
parameter = palette.gray3,
fun = foreground == "contrast" and palette.blue3Contrast or palette.blue3,
statement = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
keyword = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
fun = foreground == "saturated" and palette.blue3Saturated or palette.blue3,
statement = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
keyword = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
operator = palette.gray3,
preproc = palette.gray3,
type = foreground == "contrast" and palette.aquaContrast or palette.aqua,
regex = foreground == "contrast" and palette.red3Contrast or palette.red3,
type = foreground == "saturated" and palette.aquaSaturated or palette.aqua,
regex = foreground == "saturated" and palette.red3Saturated or palette.red3,
deprecated = palette.gray,
punct = palette.gray3,
comment = palette.gray4,
special1 = foreground == "contrast" and palette.yellow3Contrast or palette.yellow3,
special2 = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
special3 = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
special1 = foreground == "saturated" and palette.yellow3Saturated or palette.yellow3,
special2 = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
special3 = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
},
diag = {
error = palette.red,
@ -316,7 +316,7 @@ return {
}
end,
---@param palette PaletteColors
---@param foreground? "default"|"contrast"
---@param foreground? "default"|"saturated"
---@return ThemeColors
pearl = function(palette, foreground)
return {
@ -365,25 +365,25 @@ return {
},
},
syn = {
string = foreground == "contrast" and palette.pearlGreenContrast or palette.pearlGreen,
string = foreground == "saturated" and palette.pearlGreenSaturated or palette.pearlGreen,
variable = "NONE",
number = foreground == "contrast" and palette.pearlPinkContrast or palette.pearlPink,
constant = foreground == "contrast" and palette.pearlOrangeContrast or palette.pearlOrange,
identifier = foreground == "contrast" and palette.pearlViolet4Contrast or palette.pearlViolet4,
parameter = foreground == "contrast" and palette.pearlBlue5Contrast or palette.pearlBlue5,
fun = foreground == "contrast" and palette.pearlBlue4Contrast or palette.pearlBlue4,
statement = foreground == "contrast" and palette.pearlViolet4Contrast or palette.pearlViolet4,
keyword = foreground == "contrast" and palette.pearlViolet4Contrast or palette.pearlViolet4,
number = foreground == "saturated" and palette.pearlPinkSaturated or palette.pearlPink,
constant = foreground == "saturated" and palette.pearlOrangeSaturated or palette.pearlOrange,
identifier = foreground == "saturated" and palette.pearlViolet4Saturated or palette.pearlViolet4,
parameter = foreground == "saturated" and palette.pearlBlue5Saturated or palette.pearlBlue5,
fun = foreground == "saturated" and palette.pearlBlue4Saturated or palette.pearlBlue4,
statement = foreground == "saturated" and palette.pearlViolet4Saturated or palette.pearlViolet4,
keyword = foreground == "saturated" and palette.pearlViolet4Saturated or palette.pearlViolet4,
operator = palette.pearlGray3,
preproc = palette.pearlGray2,
type = foreground == "contrast" and palette.pearlAquaContrast or palette.pearlAqua,
regex = foreground == "contrast" and palette.pearlYellow2Contrast or palette.pearlYellow2,
type = foreground == "saturated" and palette.pearlAquaSaturated or palette.pearlAqua,
regex = foreground == "saturated" and palette.pearlYellow2Saturated or palette.pearlYellow2,
deprecated = palette.pearlGray3,
comment = palette.pearlGray3,
punct = palette.pearlGray3,
special1 = foreground == "contrast" and palette.pearlYellow2Contrast or palette.pearlYellow2,
special2 = foreground == "contrast" and palette.pearlViolet4Contrast or palette.pearlViolet4,
special3 = foreground == "contrast" and palette.pearlViolet4Contrast or palette.pearlViolet4,
special1 = foreground == "saturated" and palette.pearlYellow2Saturated or palette.pearlYellow2,
special2 = foreground == "saturated" and palette.pearlViolet4Saturated or palette.pearlViolet4,
special3 = foreground == "saturated" and palette.pearlViolet4Saturated or palette.pearlViolet4,
},
vcs = {
added = palette.pearlGreen2,
@ -427,7 +427,7 @@ return {
}
end,
---@param palette PaletteColors
---@param foreground? "default"|"contrast"
---@param foreground? "default"|"saturated"
---@return ThemeColors
mist = function(palette, foreground)
return {
@ -477,25 +477,25 @@ return {
},
},
syn = {
string = foreground == "contrast" and palette.green3Contrast or palette.green3,
string = foreground == "saturated" and palette.green3Saturated or palette.green3,
variable = "NONE",
number = foreground == "contrast" and palette.pinkContrast or palette.pink,
constant = foreground == "contrast" and palette.orangeContrast or palette.orange,
identifier = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
number = foreground == "saturated" and palette.pinkSaturated or palette.pink,
constant = foreground == "saturated" and palette.orangeSaturated or palette.orange,
identifier = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
parameter = palette.gray3,
fun = foreground == "contrast" and palette.blue3Contrast or palette.blue3,
statement = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
keyword = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
fun = foreground == "saturated" and palette.blue3Saturated or palette.blue3,
statement = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
keyword = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
operator = palette.gray3,
preproc = palette.gray3,
type = foreground == "contrast" and palette.aquaContrast or palette.aqua,
regex = foreground == "contrast" and palette.red3Contrast or palette.red3,
type = foreground == "saturated" and palette.aquaSaturated or palette.aqua,
regex = foreground == "saturated" and palette.red3Saturated or palette.red3,
deprecated = palette.gray,
punct = palette.gray3,
comment = palette.gray4,
special1 = foreground == "contrast" and palette.yellow3Contrast or palette.yellow3,
special2 = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
special3 = foreground == "contrast" and palette.violet2Contrast or palette.violet2,
special1 = foreground == "saturated" and palette.yellow3Saturated or palette.yellow3,
special2 = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
special3 = foreground == "saturated" and palette.violet2Saturated or palette.violet2,
},
diag = {
error = palette.red,