256 color support

Expose termbox OutputMode so users can override the default.
addColorMap to extend textbuilder with custom colors
ColorRGB24 to convert from web to terminal colors
This commit is contained in:
Matt Ranney
2016-02-04 22:20:46 -08:00
committed by Caleb Bassi
parent b715a57165
commit 606e1de924
3 changed files with 41 additions and 3 deletions

View File

@@ -138,3 +138,8 @@ func ColorRGB(r, g, b int) Attribute {
r, b, g = within(r), within(b), within(g)
return Attribute(0x0f + 36*r + 6*g + b)
}
// Convert from familiar 24 bit colors into 6 bit terminal colors
func ColorRGB24(r, g, b int) Attribute {
return ColorRGB(r/51, g/51, b/51)
}