color

package
v0.0.0-...-cbc4e0b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2014 License: AGPL-3.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package gorilla/color provides converters for different color models.

It implements Hex, HSL and HSV models following the interfaces defined in the standard image/color package.

Index

Constants

This section is empty.

Variables

View Source
var HSLModel = color.ModelFunc(hslModel)

HSLModel converts any Color to a HSL color.

View Source
var HSVModel = color.ModelFunc(hsvModel)

HSVModel converts any Color to a HSV color.

View Source
var HexModel = color.ModelFunc(hexModel)

HexModel converts any Color to an Hex color.

Functions

func HSLToRGB

func HSLToRGB(h, s, l float64) (r, g, b uint8)

HSLToRGB converts an HSL triple to a RGB triple.

Ported from http://goo.gl/Vg1h9

func HSVToRGB

func HSVToRGB(h, s, v float64) (r, g, b uint8)

HSVToRGB converts an HSV triple to a RGB triple.

Ported from http://goo.gl/Vg1h9

func HexToRGB

func HexToRGB(h Hex) (uint8, uint8, uint8)

HexToRGB converts an Hex string to a RGB triple.

func RGBToHSL

func RGBToHSL(r, g, b uint8) (h, s, l float64)

RGBToHSL converts an RGB triple to a HSL triple.

Ported from http://goo.gl/Vg1h9

func RGBToHSV

func RGBToHSV(r, g, b uint8) (h, s, v float64)

RGBToHSV converts an RGB triple to a HSV triple.

Ported from http://goo.gl/Vg1h9

Types

type HSL

type HSL struct {
	H, S, L float64
}

HSL represents a cylindrical coordinate of points in an RGB color model.

Values are in the range 0 to 1.

func (HSL) RGBA

func (c HSL) RGBA() (uint32, uint32, uint32, uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the HSL.

type HSV

type HSV struct {
	H, S, V float64
}

HSV represents a cylindrical coordinate of points in an RGB color model.

Values are in the range 0 to 1.

func (HSV) RGBA

func (c HSV) RGBA() (uint32, uint32, uint32, uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the HSV.

type Hex

type Hex string

Hex represents an RGB color in hexadecimal format.

The length must be 3 or 6 characters, preceded or not by a '#'.

func RGBToHex

func RGBToHex(r, g, b uint8) Hex

RGBToHex converts an RGB triple to an Hex string.

func (Hex) RGBA

func (c Hex) RGBA() (uint32, uint32, uint32, uint32)

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the Hex.

Jump to

Keyboard shortcuts

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