Small update to the silly-color mode

pull/232/head
Simon Roberts 3 years ago
parent 18eb944c28
commit a131fb5491
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -195,12 +195,29 @@ func Sync() error {
}
// scaledColor returns a Color that is proportional to the x/y coordinates
func scaledColor(x, y int) tcell.Color {
// temporary kludge for the pretty
func prettyColor(x, y int, st tcell.Style) tcell.Style {
// fg, bg, _ := st.Decompose()
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)
if true {
red := int32(0)
grn := int32(0)
blu := int32(50 * float64(y) / float64(h))
bg := tcell.NewRGBColor(red, grn, blu)
st = st.Background(bg)
}
if true {
red := int32(200)
grn := int32(255 * float64(y) / float64(h))
blu := int32(255 * float64(x) / float64(w))
fg := tcell.NewRGBColor(red, grn, blu)
st = st.Foreground(fg)
}
return st
}
// SetCell sets the character cell at a given location to the given
@ -208,7 +225,9 @@ func scaledColor(x, y int) tcell.Color {
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))
if bg == ColorBlack {
st = prettyColor(x, y, st)
}
screen.SetContent(x, y, ch, nil, st)
}

Loading…
Cancel
Save