fix: respect vim.o.background when loading colorscheme

- Change default background.light from "ink" to "pearl" so light mode
    uses a light theme by default
  - Clear _EXPLICIT_THEME when load() is called without arguments so
    :colorscheme kanso properly respects vim.o.background setting

  Fixes #45
This commit is contained in:
Webhooked
2026-01-10 12:39:28 +01:00
parent 927361caec
commit 26f5c9686b
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ require('kanso').setup({
end, end,
background = { -- map the value of 'background' option to a theme background = { -- map the value of 'background' option to a theme
dark = "ink", -- try "zen", "mist" or "pearl" ! dark = "ink", -- try "zen", "mist" or "pearl" !
light = "ink" -- try "zen", "mist" or "pearl" ! light = "pearl" -- try "zen", "mist" or "ink" !
}, },
foreground = "default", -- "default" or "saturated" (can also be a table like background) foreground = "default", -- "default" or "saturated" (can also be a table like background)
}) })
+4 -1
View File
@@ -25,7 +25,7 @@ M.config = {
return {} return {}
end, end,
---@type { dark: string, light: string } ---@type { dark: string, light: string }
background = { dark = "ink", light = "ink" }, background = { dark = "ink", light = "pearl" },
theme = "ink", theme = "ink",
---@type { dark: "default"|"saturated", light: "default"|"saturated" }|"default"|"saturated" ---@type { dark: "default"|"saturated", light: "default"|"saturated" }|"default"|"saturated"
foreground = "default", foreground = "default",
@@ -56,8 +56,11 @@ function M.load(theme)
local utils = require("kanso.utils") local utils = require("kanso.utils")
-- If theme is explicitly provided, use it and disable background-based switching -- If theme is explicitly provided, use it and disable background-based switching
-- If no theme is provided (e.g., :colorscheme kanso), clear explicit theme to respect vim.o.background
if theme then if theme then
M._EXPLICIT_THEME = theme M._EXPLICIT_THEME = theme
else
M._EXPLICIT_THEME = nil
end end
-- Priority order for theme selection: -- Priority order for theme selection: