/sgr

SGR is a Go package that attempts to implement every SGR ANSI escape code

Primary LanguageGoMIT LicenseMIT

SGR

MIT License Go Report Card

SGR (Select Graphic Rendition) is a simple Go package containing a large block of constants that attempts to implement every SGR ANSI escape code listed here.

Hate how other ANSI packages use functions and structs that you have to convert 20 times to get something you can print? This package is ONLY constants meaning you can have an RGB underline on text that is fast blinking with Fraktur font all inside of one constant.

Example

package main

import (
	"fmt"

	"github.com/notwithering/sgr"
)

const woah string = sgr.Italic +
	sgr.BgColorRGB + "255;0;85" + sgr.M +
	sgr.Underline +
	sgr.Overline +
	sgr.Faint +
	"wow this is so cool!" +
	sgr.Reset

func main() {
	fmt.Println(woah)
}
text 'wow this is so cool!' with magenta background and a white underline and overline

Copyright (c) 2024 Jim Philip