color

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package color provides simple utilities for using colors based on their message significance.

e.g. Success is light green, Error is bright red

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color int
const (

	// Info is a light blue color
	// to represent informational level text
	Info Color = iota

	// Error is a bright red color
	// for error messages
	Error

	// Success is a bright green color
	// for success messages
	Success

	// Warn is a bright yellow color
	// for indicating a potential issue
	Warn
)

func (Color) String added in v0.5.1

func (c Color) String() string

String returns an adaptive color to represent info, error, warn, or success based on the color theme of the terminal

Example

Get a hex code for info color

package main

import (
	"fmt"

	"github.com/brittonhayes/pkg/color"
)

func main() {
	// Setup the HEX code of the cyan info
	// color
	info := color.Info.String()

	// Print out the string
	// of the color
	fmt.Println(info)
}

Jump to

Keyboard shortcuts

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