Socket
Socket
Sign inDemoInstall

github.com/shiena/ansicolor

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/shiena/ansicolor

Package ansicolor provides color console in Windows as ANSICON.


Version published

Readme

Source

PkgGoDev Go Report Card

ansicolor

Ansicolor library provides color console in Windows as ANSICON for Golang.

Features

Escape sequenceText attributes
\x1b[0mAll attributes off(color at startup)
\x1b[1mBold on(enable foreground intensity)
\x1b[4mUnderline on
\x1b[5mBlink on(enable background intensity)
\x1b[21mBold off(disable foreground intensity)
\x1b[24mUnderline off
\x1b[25mBlink off(disable background intensity)
Escape sequenceForeground colors
\x1b[30mBlack
\x1b[31mRed
\x1b[32mGreen
\x1b[33mYellow
\x1b[34mBlue
\x1b[35mMagenta
\x1b[36mCyan
\x1b[37mWhite
\x1b[39mDefault(foreground color at startup)
\x1b[90mLight Gray
\x1b[91mLight Red
\x1b[92mLight Green
\x1b[93mLight Yellow
\x1b[94mLight Blue
\x1b[95mLight Magenta
\x1b[96mLight Cyan
\x1b[97mLight White
Escape sequenceBackground colors
\x1b[40mBlack
\x1b[41mRed
\x1b[42mGreen
\x1b[43mYellow
\x1b[44mBlue
\x1b[45mMagenta
\x1b[46mCyan
\x1b[47mWhite
\x1b[49mDefault(background color at startup)
\x1b[100mLight Gray
\x1b[101mLight Red
\x1b[102mLight Green
\x1b[103mLight Yellow
\x1b[104mLight Blue
\x1b[105mLight Magenta
\x1b[106mLight Cyan
\x1b[107mLight White

Example

package main

import (
	"fmt"
	"os"

	"github.com/shiena/ansicolor"
)

func main() {
	w := ansicolor.NewAnsiColorWriter(os.Stdout)
	text := "%sforeground %sbold%s %sbackground%s\n"
	fmt.Fprintf(w, text, "\x1b[31m", "\x1b[1m", "\x1b[21m", "\x1b[41;32m", "\x1b[0m")
	fmt.Fprintf(w, text, "\x1b[32m", "\x1b[1m", "\x1b[21m", "\x1b[42;31m", "\x1b[0m")
	fmt.Fprintf(w, text, "\x1b[33m", "\x1b[1m", "\x1b[21m", "\x1b[43;34m", "\x1b[0m")
	fmt.Fprintf(w, text, "\x1b[34m", "\x1b[1m", "\x1b[21m", "\x1b[44;33m", "\x1b[0m")
	fmt.Fprintf(w, text, "\x1b[35m", "\x1b[1m", "\x1b[21m", "\x1b[45;36m", "\x1b[0m")
	fmt.Fprintf(w, text, "\x1b[36m", "\x1b[1m", "\x1b[21m", "\x1b[46;35m", "\x1b[0m")
	fmt.Fprintf(w, text, "\x1b[37m", "\x1b[1m", "\x1b[21m", "\x1b[47;30m", "\x1b[0m")
}

screenshot

See also:

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 09 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc