Version: v0.0.0-...-1b60a0e Latest Latest Go to latest
Published: Nov 2, 2019 License: MIT

## Documentation ¶

### Overview ¶

Package color represents ranges of red, green, and blue in the range of [0, 1].

### Constants ¶

This section is empty.

### Variables ¶

This section is empty.

### Functions ¶

#### func Equals ¶

`func Equals(c1, c2 Color) bool`

Equals returns true if the passed Colors are approximately equal. Otherwise, it returns false.

### Types ¶

#### type Color ¶

```type Color struct {
Red   float64
Green float64
Blue  float64
}```

A Color is represented by percentages of red, green, and blue in the range of [0, 1]. The red, green, or blue values of a color may be lower or higher than [0, 1].

`func Add(c1, c2 Color) *Color`

Add returns a new Color with rgb values set to the sum of the passed Color rgb values.

#### func Multiply ¶

`func Multiply(c1, c2 Color) *Color`

Multiply returns a new Color with rgb values set to the product of the passed Color rgb values.

#### func NewColor ¶

`func NewColor(red, green, blue float64) *Color`

NewColor returns a new Color that has the passed red, green, and blue values.

#### func Scale ¶

`func Scale(c Color, scalar float64) *Color`

Scale returns a new Color with each of its rgb values multiplied by the passed scalar value.

#### func Subtract ¶

`func Subtract(c1, c2 Color) *Color`

Subtract returns a new Color with rgb values set to the difference of the passed Color rgb values.

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

Add modifies this Color by adding each of the passed Color's rgb values to this Color's rgb values.

#### func (*Color) Multiply ¶

`func (c *Color) Multiply(c1 Color) *Color`

Multiply modifies this Color by multiplying each of the passed Color's rgb values against this Color's rgb values.

#### func (*Color) Scale ¶

`func (c *Color) Scale(scalar float64) *Color`

Scale multiplies each of this Color's rgb values by the passed scalar value.

#### func (*Color) Subtract ¶

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

Subtract modifies this Color by subtracting each of the passed Color's rgb values from this Color's rgb values.