Skip to content

Sophuwu300/rainbowgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rainbowgo

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.

Inititalise

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)

Functions:

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)

Full Example

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() 
    }
}

image

About

Print rainbows to the terminal in Go very easily.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages