Add perceptual 16-colour mapping

Dark shades map to black and greys to the grey/white entries while
saturated category colours keep their hue, instead of the stock
conversion's bright yellow/cyan shadows.
This commit is contained in:
Andy Dixon
2026-10-02 08:38:36 +01:00
parent d7e1d3e620
commit cb8ae54258
4 changed files with 120 additions and 12 deletions
+12 -2
View File
@@ -76,7 +76,7 @@ func (m *Model) render() string {
g := computeGeometry(m.w, m.h)
if g.class == tooSmall {
m.renderTooSmall(cv)
return cv.Render(m.profile == colorprofile.ANSI256)
return cv.Render(m.depth())
}
m.tree.RLock()
defer m.tree.RUnlock()
@@ -100,7 +100,17 @@ func (m *Model) render() string {
if len(m.modals) > 0 {
m.paintModal(cv)
}
return cv.Render(m.profile == colorprofile.ANSI256)
return cv.Render(m.depth())
}
func (m *Model) depth() colorDepth {
switch m.profile {
case colorprofile.ANSI256:
return depth256
case colorprofile.ANSI:
return depth16
}
return depthTrue
}
func (m *Model) renderTooSmall(cv *Canvas) {