colour

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package colour is used for generating colours for the patterns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReMap

func ReMap(value, vMin, vMax, dMin, dMax float64) float64

ReMap is a Go implementation of Processing's map function, which maps a number from one range to another. Parameters:

  • value: value to be converted.
  • vMin/vMax: lower/upper bound of the value's current range.
  • dMin/dMax: lower/upper bound of the value's target range.

Reference: http://processing.org/reference/map_.html

Types

type Colour

type Colour struct {
	// contains filtered or unexported fields
}

Colour represents a background colour for the generated pattern.

func New

func New(htmlColour string) (*Colour, error)

New returns a Colour instance. It takes a HTML colour as a hex string: `#ff00ff`.

func NewWithSeed

func NewWithSeed(htmlColour string, str string) (*Colour, error)

New returns a Colour instance. It takes a HTML colour as a hex string: `#ff00ff`, and string to be used as a seed for generating a different colour palette.

func (*Colour) HtmlHex

func (c *Colour) HtmlHex() string

HtmlHex returns a HTML hex colour string: `#00ff00`.

func (*Colour) Rgb

func (c *Colour) Rgb() (int, int, int)

Rgb returns the RGB integer values for each colour.

Jump to

Keyboard shortcuts

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