Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Console._
import scala.util.Random
val colours = Seq(BLUE, CYAN, GREEN, MAGENTA, RED, YELLOW)
def rainbow(text: String, colours: Seq[String]) = text.zipWithIndex.map{ case (c,i) => colours(i%colours.size)+c }.mkString + RESET
for (a <- 1 to 20) println(rainbow("Yeah cool colours", Random.shuffle(colours.toList)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment