achannarasappa / ticker

Terminal stock ticker with live updates and position tracking
GNU General Public License v3.0
4.94k stars 265 forks source link

Color displayed differently with and without tmux #184

Closed ngocphamm closed 3 years ago

ngocphamm commented 3 years ago

Describe the bug I really don't know if this is a bug, and I think it's not likely. I just noticed some small differences in colors when using ticker inside tmux, and I'm not sure what's supposed to be the "correct" one.

To Reproduce Steps to reproduce the behavior:

  1. Start ticker in an iTerm2 session
  2. Start ticker in another iTerm2 session, with tmux
  3. See differences

Screenshots Without tmux CleanShot 2021-07-02 at 14 26 54

With tmux CleanShot 2021-07-02 at 14 17 30

Environment (please complete the following information):

Additional context I think both iTerm2 itself, and tmux support True Color, and just that the 2 report a different $TERM (see the lower parts of the 2 screenshot).

iTerm2 -> $TERM = xterm-256color tmux -> $TERM = screen-256color. This is due to nvim's :checkhealth complaining about the $TERM should be screen-256color CleanShot 2021-07-02 at 14 32 40

.config/ticker.yaml - made up numbers

show-summary: true
show-tags: true
show-fundamentals: true
show-separator: true
show-holdings: true
sort: "alpha"
interval: 15
currency: USD
watchlist:
  - AAPL
lots:
  - symbol: "AAPL"
    quantity: 4
    unit_cost: 123.45
  - symbol: "AMD"
    quantity: 3
    unit_cost: 67.89
  - symbol: "SHOP"
    quantity: 2
    unit_cost: 1234.56
  - symbol: "SONO"
    quantity: 1
    unit_cost: 45.67
achannarasappa commented 3 years ago

Thanks for taking the time to report this in so much detail.

It looks like the issue in your case if that $TERM is set to screen-256color which will have ticker fallback to ANSI256 colors. The logic for this fallback is defined in a dependency of ticker here if you're interested in having a look.

You can try starting ticker with the $TERM value set for this one command e.g. TERM=truecolor ticker -w AAPL

Hope that helps

ngocphamm commented 3 years ago

Thanks @achannarasappa for your response! I just wanted to know which one is supposed to be the correct truecolor supported by ticker and from your answer, it's the first screenshot (without tmux). I got that by changing the $TERM to tmux-256 with a patch for macOS, so it's all good now.

Thank you for making this!