Skip to content
This repository was archived by the owner on May 10, 2026. It is now read-only.

ams-tech-fin/tic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TIC

Warning

This module is deprecated.

The project has moved to:

https://github.com/ams-soft/tic

┌─┴─┴─┴─┴─┴─┴─┴─┴─┐
🭲○  ♦ 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.

Features

  • 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

Installation

go get github.com/ams-tech-fin/tic

Basic Usage

Applying Colors

package 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))
}

Text Styles

// 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))

Style Builder (Fluent Composition)

// 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)

Terminal Control

// 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)

Color Palette

The library includes the complete VIC-II palette:

  • ColorBlack, ColorWhite
  • ColorRed, ColorCyan, ColorPurple, ColorGreen, ColorBlue, ColorYellow
  • ColorOrange, ColorBrown
  • ColorLightRed, ColorLightGreen, ColorLightBlue
  • ColorDarkGray, ColorMediumGray, ColorLightGray
  • ColorLightPurple, ColorDarkPurple

Thematic colors:

  • ColorC64BG, ColorC64FG - Classic Commodore 64 colors
  • ColorA800BG, ColorA800FG - Classic Atari 800 colors

Demo

To run the interactive demo:

make dev

Or directly:

go run ./cmd/tic-demo/main.go

The demo shows:

  • Retro themes (C64, A800, CRT)
  • Complete color showroom
  • Text style examples
  • Style Builder demonstration
  • Visual terminal effects
  • Complete ANSI 256 color table

Utility Functions

// 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

License

©2025 - AMS SOFT

About

terminal integrated colors

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors