concolor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 9

Documentation

Overview

Package concolor provides console color creation functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Red color
	Red = RGB(255, 0, 0)
	// Blue color
	Blue = RGB(0, 0, 255)
	// Green color
	Green = RGB(0, 255, 0)
	// White color
	White = RGB(255, 255, 255)
	// Black color
	Black = RGB(0, 0, 0)
)

Functions

This section is empty.

Types

type Color

type Color struct {
	R byte
	G byte
	B byte
	A byte
}

Color represents a RGBA color in the console

func Hex

func Hex(hex string) (Color, error)

Hex creates a new color from a hex string

func MustHex

func MustHex(hex string) Color

MustHex creates a new color from a hex string and instead of returning an error if the hex could not be parsed it will return a transparent color

func RGB

func RGB(r, g, b byte) Color

RGB creates a new color from R,G,B values

func RGBA

func RGBA(r, g, b, a byte) Color

RGBA creates a new color from R,G,B,A values

func (Color) Floats

func (c Color) Floats() (r, g, b, a float64)

Floats returns the color values as floats (0f - 1f)

func (Color) P

func (c Color) P() *Color

P returns a pointer to the color

func (Color) RGBA

func (c Color) RGBA() (r, g, b, a uint32)

RGBA returns the color values as uint32s

func (Color) SetA

func (c Color) SetA(a byte) Color

SetA creates a new color with a changed alpha value

func (Color) SetB

func (c Color) SetB(b byte) Color

SetB creates a new color with a changed blue value

func (Color) SetG

func (c Color) SetG(g byte) Color

SetG creates a new color with a changed green value

func (Color) SetR

func (c Color) SetR(r byte) Color

SetR creates a new color with a changed red value

Jump to

Keyboard shortcuts

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