[BUG] Contrast correction makes dim and normal text identical on dark backgrounds
Summary
Minimum-contrast correction can make normal and dim (SGR 2) text identical. With the Light foreground on a black or dark gray background, both become white. I first noticed this in Codex's empty input placeholder. It also occurs with direct ANSI output and a font name without a weight suffix.
Steps to reproduce
- Load Kaku's bundled defaults and use this configuration. This is also the result of following macOS Light appearance while overriding only the background:
local wezterm = require 'wezterm'
local config = dofile('/Applications/Kaku.app/Contents/Resources/kaku.lua')
config.font = wezterm.font('Sarasa Term Slab SC')
config.color_scheme = 'Kaku Light'
config.colors = config.colors or {}
config.colors.background = '#000000'
config.text_min_contrast_ratio = 3.0
return config
- Print normal and dim text:
printf '\033[0mNormal text\033[0m\n\033[2mDim text\033[0m\n'
printf '\033[48;2;30;30;30mNormal placeholder\033[0m\n\033[48;2;30;30;30m\033[2mDim placeholder\033[0m\n'
- Compare the two lines on each background.
Expected vs actual
- Expected: Dim text stays visibly distinct when contrast correction replaces its foreground, provided the dim replacement still meets the requested contrast ratio.
- Actual: Both normal and dim text become
#FEFEFE. The renderer applies dim first, then contrast correction replaces the result with the same white used for normal text.
Environment
- Kaku version: 0.27.1
- macOS version: 27.2
- Machine: MacBook Pro (Mac14,6)
- Shell: zsh
- Application where first observed: Codex CLI 0.166.0 in tmux 3.8
- Also reproduced with direct ANSI output. A controlled tmux wire capture retains SGR 2, including on a truecolor dark background.
Optional details
The actual color helper reproduces this with foreground RGB(16,15,15), background RGB(0,0,0) or RGB(30,30,30), and minimum ratio 3.0. The new regression test fails on the original behavior.
PR #617 preserves dim on a contrast replacement without dimming an unchanged color twice or overriding selection/block-cursor colors. A stricter requested contrast ratio still takes precedence when the dim replacement cannot meet it.
A related defect found during this investigation affects named faces such as Sarasa Term Slab SC Light: generated Half rules strip the weight suffix and select a different face. The same PR preserves the selected face. That font defect alone did not explain or fix the contrast failure above.
Extra context
Related: #238 and #481. Selecting Kaku Dark instead of mixing a Light palette with a forced black background is a configuration workaround. The rendering fix was also verified in a built app with a copy of the reporter's existing configuration, without changing its automatic theme selection or black background, both directly and through an isolated tmux session.
@multics Thanks for the careful report and the fix in #617, it is merged and shipped in V0.28.0.
Dim text now stays dimmer than normal text when minimum contrast correction kicks in, and named faces such as Sarasa Term Slab SC Light keep their weight for dim text, with no config change needed.
Update from the Kaku menu with Check for Updates, or run brew upgrade --cask kaku.