orchid icon indicating copy to clipboard operation
orchid copied to clipboard

256 colour terminal support

Open jai-x opened this issue 6 years ago • 1 comments

This music player is really cool, although I am missing out on the album art feature due to not having a true colour terminal available.

Could there be an option such that the colours used in the album art display be approximated to within the 256 colour range?

jai-x avatar May 24 '18 17:05 jai-x

Hi, I'll give it a go when I'm free. Although your best bet if you really want to use it (and know some Go) is to look into ansimage/ansimage.go and manually tweak it so that you approximate the true RGB values. I won't be changing this file much, so it is safe (for the foreseeable future) to mess about with it in your fork. Line 88 is where you should modify:

// Render returns the ANSI-compatible string form of ANSI-pixel.
func (ap *ANSIpixel) Render() string {
	if ap.upper {
		return fmt.Sprintf(
			"\033[48;2;%d;%d;%dm",
			ap.R, ap.G, ap.B,
		)
	}
	return fmt.Sprintf(
		"\033[38;2;%d;%d;%dm%s",
		ap.R, ap.G, ap.B,
		lowerHalfBlock,
	)
}

PS: In the future I might port orchid to use gdamore/tcell to avoid hacking around termbox so I will change the file, but I don't really have a hard deadline on when I'll do that, if ever.

eugene-eeo avatar May 24 '18 18:05 eugene-eeo