From d1ba9eaf7cbba347fffba9a12008f7105bc4d703 Mon Sep 17 00:00:00 2001
From: Webhooked <9132742+webhooked@users.noreply.github.com>
Date: Mon, 28 Jul 2025 09:33:50 +0200
Subject: [PATCH] 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" }`
---
README.md | 22 ++++-----
lua/kanso/colors.lua | 96 +++++++++++++++++++--------------------
lua/kanso/init.lua | 6 +--
lua/kanso/themes.lua | 106 +++++++++++++++++++++----------------------
4 files changed, 115 insertions(+), 115 deletions(-)
diff --git a/README.md b/README.md
index faf0675..99bc5d4 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@
- π Compatible with popular plugins out of the box
- β‘ Compilation to lua byte code for fast startup times
- π¨ Four beautiful theme variants to match your mood and environment
-- π Contrast mode for enhanced syntax highlighting visibility
+- π Saturated mode for enhanced syntax highlighting visibility
- ποΈ WCAG 2.1 AA compliant
## π¦ Installation
@@ -98,7 +98,7 @@ require('kanso').setup({
dark = "ink", -- try "zen" !
light = "pearl" -- try "mist" !
},
- foreground = "default", -- "default" or "contrast" (can also be a table like background)
+ foreground = "default", -- "default" or "saturated" (can also be a table like background)
})
-- setup must be called before loading
@@ -137,12 +137,12 @@ KansΕ comes in four beautiful variants:
β§ Ink β§
- Balanced theme with elegant contrast.
+ Balanced theme with elegant colors.
β§ Mist β§
- Soft & muted dark theme with gentle contrast.
+ Soft & muted dark theme with gentle colors.
@@ -178,12 +178,12 @@ require("kanso").load("zen")
-## π Foreground Contrast
+## π Foreground Saturation
-KansΕ now supports a foreground contrast option that enhances the saturation of syntax highlighting colors while keeping the same background colors. This is useful for improving visibility in certain lighting conditions or personal preference.
+KansΕ now supports a foreground saturation option that enhances the saturation of syntax highlighting colors while keeping the same background colors. This is useful for improving visibility in certain lighting conditions or personal preference.
-π Using Contrast Mode
+π Using Saturated Mode
The `foreground` option can be configured per background mode:
@@ -191,12 +191,12 @@ The `foreground` option can be configured per background mode:
require('kanso').setup({
foreground = {
dark = "default", -- Use default colors in dark mode
- light = "contrast" -- Use higher saturation in light mode
+ light = "saturated" -- Use higher saturation in light mode
},
})
```
-When set to `"contrast"`, syntax highlighting colors will have increased saturation making them stand out more against the background:
+When set to `"saturated"`, syntax highlighting colors will have increased saturation making them stand out more against the background:
- Zen, Ink, and Mist themes: 20% more vibrant colors
- Pearl theme: 40% more vibrant colors
@@ -205,9 +205,9 @@ This is particularly useful:
- In bright environments where you need more color distinction
- For users who prefer more vibrant syntax highlighting
-- When using the light themes where contrast can be beneficial
+- When using the light themes where increased saturation can be beneficial
-The contrast adjustment only affects syntax highlighting colors (strings, keywords, functions, etc.) and does not change UI elements or background colors.
+The saturation adjustment only affects syntax highlighting colors (strings, keywords, functions, etc.) and does not change UI elements or background colors.
diff --git a/lua/kanso/colors.lua b/lua/kanso/colors.lua
index 26e0559..95def02 100644
--- a/lua/kanso/colors.lua
+++ b/lua/kanso/colors.lua
@@ -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
diff --git a/lua/kanso/init.lua b/lua/kanso/init.lua
index a63b247..23e6295 100644
--- a/lua/kanso/init.lua
+++ b/lua/kanso/init.lua
@@ -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,
diff --git a/lua/kanso/themes.lua b/lua/kanso/themes.lua
index fa6bf9a..3769b20 100644
--- a/lua/kanso/themes.lua
+++ b/lua/kanso/themes.lua
@@ -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,