Skip to content

notwithering/sgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages