┌─┴─┴─┴─┴─┴─┴─┴─┴─┐
🭲○ ♦ AMS TIC ♦ 🭲
└─┬─┬─┬─┬─┬─┬─┬─┬─┘
TIC is a Go library for terminal styling with ANSI colors, inspired by the VIC-II (Commodore 64) and Atari 800 color palettes.
- Complete VIC-II color palette from Commodore 64
- Atari 800 colors
- Support for 16 and 256 ANSI colors
- Text styles (bold, italic, underline, blink, etc.)
- Style Builder for fluent style composition
- Foreground and background control
- Functions to clear and paint the entire screen
- Utilities for stripping ANSI codes
go get github.com/ams-tech-fin/ticpackage main
import (
"fmt"
"github.com/ams-tech-fin/tic"
)
func main() {
// Text with foreground color
fmt.Println(tic.ColorText("Hello, World!", tic.ColorCyan))
// Text with background color
fmt.Println(tic.ColorBg("Colored background", tic.ColorYellow))
// Text with foreground and background
fmt.Println(tic.WithColors("Styled text", tic.ColorWhite, tic.ColorBlue))
}// Simple styles
fmt.Println(tic.Bold("Bold text"))
fmt.Println(tic.Italic("Italic text"))
fmt.Println(tic.Underline("Underlined text"))
fmt.Println(tic.Blink("Blinking text"))
fmt.Println(tic.Reverse("Reversed text"))
fmt.Println(tic.Strike("Strikethrough text"))
fmt.Println(tic.Dim("Dimmed text"))
// Combining color with style
colored := tic.ColorText("Green and bold", tic.ColorLightGreen)
fmt.Println(tic.Bold(colored))// Compose multiple styles fluently
success := tic.Style().
Fg(tic.ColorLightGreen).
Bg(tic.ColorBlack).
Bold().
Sprint("SUCCESS: operation completed")
error := tic.Style().
Fg(tic.ColorLightRed).
Bg(tic.ColorBlack).
Bold().
Underline().
Sprint("ERROR: operation failed")
fmt.Println(success)
fmt.Println(error)// Set foreground color globally
tic.SetFg(tic.ColorCyan)
fmt.Println("This text is cyan")
// Set background color globally
tic.SetBg(tic.ColorBlack)
fmt.Println("This text has black background")
// Reset all colors and styles
tic.ResetAll()
// Clear screen
tic.ClearScreen()
// Clear and paint entire screen with a color
tic.ClearScreenWithBg(tic.ColorC64BG)The library includes the complete VIC-II palette:
ColorBlack,ColorWhiteColorRed,ColorCyan,ColorPurple,ColorGreen,ColorBlue,ColorYellowColorOrange,ColorBrownColorLightRed,ColorLightGreen,ColorLightBlueColorDarkGray,ColorMediumGray,ColorLightGrayColorLightPurple,ColorDarkPurple
Thematic colors:
ColorC64BG,ColorC64FG- Classic Commodore 64 colorsColorA800BG,ColorA800FG- Classic Atari 800 colors
To run the interactive demo:
make devOr directly:
go run ./cmd/tic-demo/main.goThe demo shows:
- Retro themes (C64, A800, CRT)
- Complete color showroom
- Text style examples
- Style Builder demonstration
- Visual terminal effects
- Complete ANSI 256 color table
// Strip ANSI codes from a string
text := tic.ColorText("Colored", tic.ColorRed)
clean := tic.StripANSI(text) // "Colored"
// Print ANSI 256 color table
tic.PrintANSI256Table()
// Redefine output writer (useful for testing)
tic.SetOutput(customWriter)
tic.ResetOutput() // back to os.Stdout©2025 - AMS SOFT