diag icon indicating copy to clipboard operation
diag copied to clipboard

Hard to read default color scheme

Open dveeden opened this issue 3 years ago • 3 comments

Bug Report

On CentOS 7 with the default terminal configuration the light-yellow on white as seen here is hard to read:

image

What version of Diag are you using (tiup diag --version)?

$ tiup diag --version
Starting component `diag`: /home/dvaneeden/.tiup/components/diag/v0.5.1/diag --version
tiup diag v0.5.1 @master (53c4a871483dd8ff144b8fd18f812fe1cbbc86fe)

dveeden avatar Jan 13 '22 11:01 dveeden

The UI was not adjusted for light color consoles, how would you think if we add a dark background for those light colored chars?

AstroProfundis avatar Jan 18 '22 03:01 AstroProfundis

package main

import (
	"bufio"
	"fmt"
	"os"

	"golang.org/x/crypto/ssh/terminal"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	s, _ := terminal.MakeRaw(int(os.Stdin.Fd()))
	fmt.Printf("\x1b]11;?\a")
	c := make([]byte, 23)
	reader.Read(c)
	terminal.Restore(int(os.Stdin.Fd()), s)
	fmt.Printf("Terminal Color: %s\n", c[5:])
}

This results in:

Black background:

$ ./bgcolor 
Terminal Color: rgb:0000/0000/0000

White background:

$ ./bgcolor 
Terminal Color: rgb:ffff/ffff/ffff

Yellow background:

$ ./bgcolor 
Terminal Color: rgb:ffff/ffff/dddd

We can use this to either select more appropriate colors or to set color.NoColor = true.

dveeden avatar Jan 18 '22 16:01 dveeden

The UI was not adjusted for light color consoles, how would you think if we add a dark background for those light colored chars?

That might move the problem as dark colors on a dark background might not be very readable as well. I think we should choose the right colors depending on the background color.

However a slightly darker color might work well enough on both white and black backgrounds.

dveeden avatar Jan 18 '22 16:01 dveeden