Print rainbows to the terminal in Go very easily.
Want to print a rainbow to your terminal in Go? It's very easy. This package handles all the work of calculating gradients for you.
A variable of type Rainbow can be made and then initalised with the desired length of the rainbow.
var r rainbowgo.Rainbow
r.Init(int)
Print and Println will print a string in a uniform colour.
r.Print(string)
r.Println(string)
Next will make set the rainbow variable, r, to the next colour.
r.Next()
Print2d and Print2dln will print a string with a secondary rainbow going sideways. These functions also take an interger to set the length of the second rainbow. The second rainbow will start with the same colour as the main rainbow. This can be used to make diagonal or even curved rainbows.
r.Print2d(string, int)
r.Print2dln(string, int)
package main
import "github.com/Sophuwu300/rainbowgo"
func main() {
var r rainbowgo.Rainbow
r.Init(20)
for i := 0; i < 20; i++ {
r.Print("Hello Github! I am a rainbow. ")
r.Print2dln("I am a rainbow with more colours!", 35)
r.Next()
}
}