https://github.com/justtimmm/gocolor
For better logs ✨
https://github.com/justtimmm/gocolor
console-color golang
Last synced: 6 months ago
JSON representation
For better logs ✨
- Host: GitHub
- URL: https://github.com/justtimmm/gocolor
- Owner: JustTimmm
- License: mit
- Created: 2024-08-25T22:58:31.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-05-27T20:11:59.000Z (about 1 year ago)
- Last Synced: 2025-05-27T20:33:48.312Z (about 1 year ago)
- Topics: console-color, golang
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🎨 GoColor
GoColor is a lightweight Go library for adding colors and styles to your terminal output.
Instantly enhance the readability of your logs and CLI messages!
## 🚀 Installation
To install GoColor, run:
```bash
go get github.com/JustTimmm/GoColor
```
Then import it into your project:
```go
import "github.com/JustTimmm/GoColor"
```
## ✨ Quick Example
With GoColor, you can apply text colors, background colors, and text styles (like bold, italic, etc.) to your strings. Here is a basic example:
```go
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")
// Text + Background color
GoColor.ColorLog(GoColor.ColorOption{
TextColor: GoColor.Red,
BackgroundColor: GoColor.BackgroundBlue,
}, "GoColor on top!\n")
}
```

## 🛠️ Predefined Logs
GoColor includes several built-in styled logs:
```go
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")
GoColor.RainbowLog("Rainbow Log!\n")
```

## License
This project is licensed under the MIT License. See the LICENSE file for details.