mirror of
https://github.com/KevinMidboe/motdGO.git
synced 2025-10-29 09:40:23 +00:00
Code cleaning, update Readme
This commit is contained in:
@@ -1 +1,32 @@
|
||||
// Print a colored string with the 'standard' figlet font
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/probandula/figlet4go"
|
||||
// This package is used to define the colors
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
const str string = "Colored"
|
||||
|
||||
func main() {
|
||||
ascii := figlet4go.NewAsciiRender()
|
||||
|
||||
// Add the colors to the options
|
||||
options := figlet4go.NewRenderOptions()
|
||||
options.FontColor = []color.Attribute{
|
||||
color.FgGreen,
|
||||
color.FgYellow,
|
||||
color.FgCyan,
|
||||
}
|
||||
|
||||
// Use the RenderOpts instead of the Render method
|
||||
renderStr, err := ascii.RenderOpts(str, options)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Print(renderStr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user