GoColor is a simple library that allows you to add colors and styles to your terminal output in Golang. It makes it easy to apply text colors, background colors, and various text styles to enhance the readability of your logs and terminal outputs.
To install GoColor, use the following command:
go get github.com/JustTimmm/GoColor
Then, import the library into your project:
import "github.com/JustTimmm/GoColor"
With GoColor, you can apply text colors, background colors, and text styles (like bold, italic, etc.) to your strings. Here is a basic example:
package main
import "github.com/JustTimmm/GoColor"
func main() {
// Text color
GoColor.ColorLog(GoColor.ColorOption{TextColor: GoColor.Red}, "GoColor on top !\n")
// Background color
GoColor.ColorLog(GoColor.ColorOption{BackgroundColor: GoColor.BackgroundBlue}, "GoColor on top !\n")
// Background & Text color
GoColor.ColorLog(GoColor.ColorOption{BackgroundColor: GoColor.BackgroundBlue, TextColor: GoColor.Red}, "GoColor on top !\n")
}
There are different predefined logs for 5 log types!
GoColor.ErrorLog("Error log!\n")
GoColor.SuccessLog("Success log!\n")
GoColor.InfoLog("Info log!\n")
GoColor.DebugLog("Debug log!\n")
GoColor.WarnLog("Warn log!\n")
This project is licensed under the MIT LICENSE. See the LICENSE file for more details.