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

random colours for stream sometimes not readable #4

Open
KonstantinGasser opened this issue Feb 8, 2023 · 3 comments
Open

random colours for stream sometimes not readable #4

KonstantinGasser opened this issue Feb 8, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@KonstantinGasser
Copy link
Owner

each new stream connecting to scotty gets assigned a random tag color. However from time to time the color is not visible (either to light or to dark). Also the color is used as the tag background and the foreground color for the stream prefix of a log.

On a side node there is a function called InvertColor which should decide whether to use #ffffff or #000000 as a foreground color for the tag text. However it does not seem to work properly.

Goal would be that the random color is always a readable color + the chosen tag foreground color is well readable in respect to its background color.

@KonstantinGasser KonstantinGasser added bug Something isn't working good first issue Good for newcomers labels Feb 8, 2023
@petryeric
Copy link
Contributor

wouldnt it be more convenient to just set a default color that is generated (or maybe a few depending on proper usecase) instead of a random color which has a much higher chance of not being readable

@KonstantinGasser
Copy link
Owner Author

KonstantinGasser commented May 4, 2023

Hi @petryeric, having predefined colours could be a smart idea. Unfortunately, we cannot have just one colour as each stream should have a unique colour.

What we would need to ensure however, is that we don't really know how many streams are going to connect so we would need N predefined colours sets with background and foreground. Sure we could do say 32 sets of colours as that feels enough - That was the reason I choose to use random colours.

Maybe we could also define a range of say R G B ranges which we know will not cause colour issues and based on these ranges generate a random colour.

Alternatively I though that as long as the function to determine whether to use #ffffff or #000000 would work properly it would already be good.

Also what we would need to ensure is that a predefined colour is not used twice which however shouldn't be any issue.

What are your thought on predefined colours taking in account that we can have N streams each having a unique colour?
Lastly, if a stream disconnects and reconnects it should get the same colour assigned (this is already build in the system, and should not be changed).

Happy to hear some ideas/feedback 😄

@KonstantinGasser
Copy link
Owner Author

While browsing through lipgloss I found this which could be very interesting. Didn't tested it yet but would solve one issue where colors in the config could be chosen in accordance to the tty background - what we need to test if the color can also be chosen based on the background of a text.. This would solve quite a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants