crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

MacOS terminal not displaying RGB colors correctly

Open joshka opened this issue 2 years ago • 1 comments

Describe the bug A Ratatui user (@nx10) using crossterm as a backend cut us an issue (https://github.com/ratatui-org/ratatui/issues/475) about macOS terminal rendering RGB colors incorrectly (with blinking). This seems to be an upstream problem rather than one in Ratatui.

I'm unsure whether this is a Terminal.app bug (and hence perhaps the remedy is to document it as an unsupported platform while submitting the issue to Apple for a fix) or a Crossterm bug.

My example code to repro this is in https://github.com/ratatui-org/ratatui/pull/476 (run cargo run --example colors and hit space) image Expected (iTerm2): image

I was able to repro something similar using the Crossterm interactive demo. Here's a screenshot of the blue screen: image

To Reproduce Steps to reproduce the behavior:

  1. Open Mac terminal.app
  2. cd examples/interactive-demo
  3. cargo run
  4. Select colors, and hit space 5 times to get to the blue values demo (the red and green channels also render incorrectly, but don't blink)

Expected behavior The following is the blue screen rendered in iTerm2: image

OS

  • Mac

Terminal/Console

  • Terminal.app

joshka avatar Sep 09 '23 03:09 joshka

Actually, this affects termion too (and termwiz seems to fallback to ansi colors), so it's just Terminal.app not supporting true color: https://discussions.apple.com/thread/250459018 https://discussions.apple.com/thread/250636611

So perhaps this can really just be handled with docs.

Interestingly the approach that Termwiz uses for this is to fallback to an ANSI color on non true color enabled terminals, which is neat.

joshka avatar Sep 09 '23 03:09 joshka