color

package
v0.0.0-...-e938fac Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Color utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	COLOR_RED   = NewColorRGBA(1, 0, 0, 1)
	COLOR_GREEN = NewColorRGBA(0, 1, 0, 1)
	COLOR_BLUE  = NewColorRGBA(0, 0, 1, 1)

	COLOR_BLACK = NewColorRGBA(0, 0, 0, 1)
	COLOR_WHITE = NewColorRGBA(1, 1, 1, 1)

	COLOR_YELLOW  = NewColorRGBA(1, 1, 0, 1)
	COLOR_CYAN    = NewColorRGBA(0, 1, 1, 1)
	COLOR_MAGENDA = NewColorRGBA(1, 0, 1, 1)
)

Functions

This section is empty.

Types

type ColorRGBA

type ColorRGBA struct {
	R, G, B, A float32
}

Holds red, green, blue, alpha values. Each should be clamped in [0,1]. A=1 is fully opaque.

func NewColorRGBA

func NewColorRGBA(r, g, b, a float32) ColorRGBA

func NewColorRGBAFromArray

func NewColorRGBAFromArray(color [4]float32) ColorRGBA

func NewColorRGBAFromBytes

func NewColorRGBAFromBytes(r, g, b, a uint8) ColorRGBA

func NewColorRGBAFromSlice

func NewColorRGBAFromSlice(color []float32) ColorRGBA

func NewColorRGBRFromImageColor

func NewColorRGBRFromImageColor(c color.Color) ColorRGBA

func (*ColorRGBA) Clamp

func (c *ColorRGBA) Clamp()

Make sure each component is in [0,1]

func (*ColorRGBA) Scale

func (c *ColorRGBA) Scale(r, g, b, a float32)

func (*ColorRGBA) ToArray

func (c *ColorRGBA) ToArray() [4]float32

func (*ColorRGBA) ToImageRGBA

func (c *ColorRGBA) ToImageRGBA() color.RGBA

Jump to

Keyboard shortcuts

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