A lightweight Go library for creating beautifully styled terminal text output with an intuitive fluent API.
- 🎨 Rich Text Styling: Support for colors, bold, italic, and combined styles
- 🔤 Fluent API: Chain methods for readable and expressive code
- 📝 Flexible Output: Write to any
io.Writeror use default stdout - 🎯 Simple Integration: Easy to integrate into any Go project
- 🌈 Dracula Theme: Built-in color palette inspired by Dracula theme
go get github.com/opencommand/tingepackage main
import "github.com/opencommand/tinge"
func main() {
tinge.Styled().
Bold("Hello, ").
Green("World!").
Newline().
Grey("This is a ").
Italic("styled").
Grey(" message.").
Write()
}// Create a new styled text instance
text := tinge.Styled()
// Add styled content
text.Bold("Bold text").
Space().
Italic("Italic text").
Newline().
Red("Red text").
Green("Green text")Grey()- Light grey textGreyDark()- Dark grey textRed()- Red textGreen()- Bright green textGreenLight()- Light green textGreenDark()- Dark green textPink()- Pink textYellow()- Yellow textBlue()- Light blue textBlueDark()- Dark blue text
Bold()- Bold textItalic()- Italic textBoldItalic()- Bold and italic text
tinge.Styled().
Text("First line").
Newline().
Indent(4).
Text("Indented line").
Newline().
Space(8).
Text("Spaced text")Use the With() method to apply custom styles:
customStyle := lipgloss.NewStyle().Underline(true)
tinge.Styled().
With(customStyle).
Text("Custom styled text")// Write to stdout (default)
text.Write()
// Write to a specific writer
var buf strings.Builder
text.Write(&buf)
// Set default output writer
tinge.SetWriter(os.Stderr)package main
import (
"github.com/opencommand/tinge"
)
func main() {
tinge.Styled().
Bold("Welcome to ").
Blue("Tinge").
Bold("!").
Newline().
Newline().
Grey("This library provides:").
Newline().
Indent(2).
Green("✓ ").
Text("Beautiful terminal output").
Newline().
Indent(2).
Green("✓ ").
Text("Fluent API design").
Newline().
Indent(2).
Green("✓ ").
Text("Easy integration").
Newline().
Newline().
Yellow("Get started today!").
Write()
}Styled()- Create a new styled text instanceText(string)- Add plain textSpace(int?)- Add spaces (default: 1)Newline()- Add a newlineIndent(int)- Set indentation for subsequent linesWrite(...io.Writer)- Output the styled text
Grey(string)- Light grey textGreyDark(string)- Dark grey textRed(string)- Red textGreen(string)- Bright green textGreenLight(string)- Light green textGreenDark(string)- Dark green textPink(string)- Pink textYellow(string)- Yellow textBlue(string)- Light blue textBlueDark(string)- Dark blue text
Bold(string)- Bold textItalic(string)- Italic textBoldItalic(string)- Bold and italic text
With(...TextStyle)- Apply custom stylesString()- Get the rendered stringSetWriter(io.Writer)- Set default output writer
- charmbracelet/lipgloss - Terminal styling library
- Go 1.23.5 or later
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Check out the examples in the repository for more usage patterns and advanced features.