chalk

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 1 Imported by: 9 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Chalk - Terminal string styling

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/chalk

Getting Started

import (
  "testing"
  "github.com/go-zoox/chalk"
)

func main() {
	fmt.Println(chalk.Red("Hello, World!"))
}

Inspired by

  • chalk/chalk - 🖍 Terminal string styling done right
  • ttacon/chalk - Intuitive package for prettifying terminal/console output

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Black is the black color
	Black = New(30, 39)
	// Red is the red color
	Red = New(31, 39)
	// Green is the green color
	Green = New(32, 39)
	// Yellow is the yellow color
	Yellow = New(33, 39)
	// Blue is the blue color
	Blue = New(34, 39)
	// Magenta is the magenta color
	Magenta = New(35, 39)
	// Cyan is the cyan color
	Cyan = New(36, 39)
	// White is the white color
	White = New(37, 39)
	// Gray is the gray color
	Gray = New(90, 39)
)
View Source
var (
	// Success is the success color
	Success = func(message string) string {
		return Green("✔ " + message)
	}
	// Info is the info color
	Info = func(message string) string {
		return Blue("ℹ " + message)
	}
	// Warn is the warn color
	Warn = func(message string) string {
		return Yellow("⚠ " + message)
	}
	// Error is the error color
	Error = func(message string) string {
		return Red("✖ " + message)
	}
	// Debug is the debug color
	Debug = func(message string) string {
		return White("ℹ " + message)
	}
)
View Source
var Version = "1.0.2"

Version is the current version of chalk

Functions

func New

func New(value int, reset int) func(string) string

New creates a new color

Types

type Color

type Color struct {
	// contains filtered or unexported fields
}

Color represents one of the ANSI color escape codes. http://en.wikipedia.org/wiki/ANSI_escape_code#Colors

func (Color) Color

func (c Color) Color(val string) string

Color colors the foreground of the given string

func (Color) String

func (c Color) String() string

String returns the string representation of this color

func (Color) Value

func (c Color) Value() int

Value returns the individual value for this color

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址