Silly TrueColor test

pull/232/head
Simon Roberts 3 years ago
parent 8ce74b1886
commit 49aeb8b84e
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -191,10 +191,21 @@ func Sync() error {
return nil
}
// scaledColor returns a Color that is proportional to the x/y coordinates
func scaledColor(x, y int) tcell.Color {
w, h := screen.Size()
blu := int32(255 * float64(x) / float64(w))
grn := int32(255 * float64(y) / float64(h))
red := int32(200)
return tcell.NewRGBColor(red, grn, blu)
}
// SetCell sets the character cell at a given location to the given
// content (rune) and attributes.
func SetCell(x, y int, ch rune, fg, bg Attribute) {
st := mkStyle(fg, bg)
// Set the foreground color to a scaled version of the coordinates
st = st.Foreground(scaledColor(x, y))
screen.SetContent(x, y, ch, nil, st)
}

Loading…
Cancel
Save