color

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 0 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) Hex

func (c Color) Hex() string
Example (Info)

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.Hex()

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

func (Color) RGB

func (c Color) RGB() RGB
Example (Error)

Get an RGB format for the error color

package main

import (
	"fmt"

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

func main() {

	// Setup the RGB of the red error
	// color
	errorColor := color.Error.RGB()

	// Print out the struct
	// of the color
	fmt.Println(errorColor)
}

type RGB

type RGB struct {
	Red   string
	Green string
	Blue  string
}

Jump to

Keyboard shortcuts

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