Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Colors between 008-015 are not working as I expected #927

Closed
Slabity opened this issue Jul 23, 2018 · 5 comments
Closed

Colors between 008-015 are not working as I expected #927

Slabity opened this issue Jul 23, 2018 · 5 comments

Comments

@Slabity
Copy link

Slabity commented Jul 23, 2018

Describe Your Issue

Colors from the 008-015 range are not working properly in my terminal.

I expect this: https://i.imgur.com/6uUBOgX.png

But I get this: https://i.imgur.com/tjzI9IE.png

Have you tried to debug or fix it?

Yes. It appears the issue originates from 4d18fdc. In functions/colors.zsh, there are two points where we subtract 8 from the actual color given. Removing these seems to fix my color issues.

In function getColor():

  if [[ "$1" = <-> ]]; then
    if [[ "$1" = <8-15> ]]; then
      1=$(($1 - 8))
    fi
  else
  ...

In function getColorCode():

  if [[ "$1" = <-> ]]; then
    # ANSI color codes distinguish between "foreground"
    # and "background" colors. We don't need to do that,
    # as ZSH uses a 256 color space anyway.
    if [[ "$1" = <8-15> ]]; then
      echo -n $(($1 - 8))
    else
      echo -n "$1"
    fi
  else
  ...

Environment Information

Not sure how much of this matters:

  • ZSH version 5.5.1
  • Pk9 master branch
  • Termite emulator
  • NixOS (x86_64-unknown-linux-gnu)
@Slabity
Copy link
Author

Slabity commented Jul 23, 2018

This seems quite intentional, but I do not really understand the reason behind mapping colors 008-015 to 000-007.

If anyone can provide any information or a suggested fix, then I'd appreciate it.

@Slabity Slabity changed the title Colors between 008-015 are not working properly Colors between 008-015 are not working as I expected Jul 23, 2018
@dritter dritter mentioned this issue Aug 5, 2018
@dritter
Copy link
Member

dritter commented Aug 6, 2018

Hi @Slabity !

Sorry for the late response. I wrote the code you mentioned. This code is quite old (about 3 years). Commit: 0e37d8e. TBH, I am not sure why I did it like this. Probably because the bright colors did not work on my machine, or at least I saw no difference and I wanted to treat these colors as if they were the non bright version..

I think the code could be removed safely.

@dritter
Copy link
Member

dritter commented Aug 9, 2018

Btw. I removed the code in #929 , which is merged in #944 . Could you give it a try and confirm that this works for you?

@Slabity
Copy link
Author

Slabity commented Aug 10, 2018

Looks like it worked. Thanks!

@Slabity Slabity closed this as completed Aug 10, 2018
@bhilburn
Copy link
Member

Merged into master as part of #944! Will be in the v0.6.6 release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants