color

package
v0.0.0-...-8cfed74 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Black = New(0, 0, 0)

Black color

View Source
var White = New(1, 1, 1)

White color

Functions

func ToInt

func ToInt(c float64) string

ToInt converts a float color to a number lying between 0 and 255

Types

type Color

type Color struct {
	R float64
	G float64
	B float64
}

Color represents a color in RGB notation

func FromHex

func FromHex(hex string) Color

FromHex returns a color from a hex string

func New

func New(r, g, b float64) Color

New returns an RGB color

func (*Color) Add

func (c *Color) Add(c2 Color) Color

Add returns c1 + c2

func (*Color) Equals

func (c *Color) Equals(c2 Color) bool

Equals reports whether two colors are the same

func (*Color) Multiply

func (c *Color) Multiply(x float64) Color

Multiply returns the product of a color and a scalar

func (*Color) MultiplyColor

func (c *Color) MultiplyColor(c2 Color) Color

MultiplyColor returns the product of two colors

func (*Color) Subtract

func (c *Color) Subtract(c2 Color) Color

Subtract returns c1 - c2

func (*Color) ToPPMPixel

func (c *Color) ToPPMPixel() string

ToPPMPixel represent a color as a PPM pixel

Jump to

Keyboard shortcuts

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