Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModifierReverse causes characters to become clear in Gauge #306

Open
FoxFurry opened this issue Oct 9, 2021 · 1 comment
Open

ModifierReverse causes characters to become clear in Gauge #306

FoxFurry opened this issue Oct 9, 2021 · 1 comment

Comments

@FoxFurry
Copy link

FoxFurry commented Oct 9, 2021

Description

When gauge cells reach the label they (both gauge cells and label) become totally transparent

Issue screen

How to reproduce

  • Create a gauge with any style
  • Set percentage to >48%

Additional

  • Shells:
    • fish
    • zsh
    • bash
  • Color scheme:
    • sweet-mars
    • breeze
    • linux-dark
  • Terminal emulators
    • Terminator
    • Alacritty
    • Konsole
    • Yakuake

Same behavior everywhere

Possible solution

I figured out that these lines produce such behavior:

if labelXCoordinate+i+1 <= self.Inner.Min.X+barWidth {
       style = NewStyle(self.BarColor, ColorClear, ModifierReverse)
}

Removing ModifierReverse makes it normal (normal assuming we have already the wrong color calculation)
Removing ModifierReverse and swapping remaining parameters seems to almost fix the issue:

if labelXCoordinate+i+1 <= self.Inner.Min.X+barWidth {
       style = NewStyle(ColorClear, self.BarColor)
}

Almost fixed

Label color is obviously not getting reversed, so a bad color combination will result in an unreadable label. However, I haven't dig into the mathematics behind reverse color calculation and I cannot assume it's a 100% ModifierReverse issue.

@go-hacks
Copy link

go-hacks commented Nov 18, 2021

Change line 52 of gauge.go to

style.Bg = self.BarColor

this seems to give the desired result. I was unable to find a bit modifier that did what was expected.

Naturally, if you use the same color text as the bar, it's unreadable. I think whomever wrote this was trying to get the bar to have that blank area with the text the color of the bar inside it but even if it worked, it wouldn't look good at all. This fix is MUCH better.

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

No branches or pull requests

2 participants