# README
Package colors
Go color manipulation, conversion and printing library/utility
this library is currently in development, not all color types such as HSL, HSV and CMYK will be included in the first release; pull requests are welcome.
Installation
Use go get.
go get github.com/go-playground/colors
Then import the validator package into your own code.
import "github.com/go-playground/colors"
Usage and documentation
#Example
hex, err := colors.ParseHEX("#fff")
rgb, err := colors.ParseRGB("rgb(0,0,0)")
rgb, err := colors.RGB(0,0,0)
rgba, err := colors.ParseRGBA("rgba(0,0,0,1)")
rgba, err := colors.RGBA(0,0,0,1)
// don't know which color, it was user selectable
color, err := colors.Parse("#000")
color.ToRGB() // rgb(0,0,0)
color.ToRGBA() // rgba(0,0,0,1)
color.ToHEX() // #000000
color.IsLight() // false
color.IsDark() // true
How to Contribute
Make a pull request...
License
Distributed under MIT License, please see license file in code for more details.
# Functions
No description provided by the author
Parse parses an unknown color type to it's appropriate type, or returns a ErrBadColor.
ParseHEX validates an parses the provided string into a HEXColor object.
ParseRGB validates an parses the provided string into an RGBColor object supports both RGB 255 and RGB as percentages.
ParseRGBA validates an parses the provided string into an RGBAColor object supports both RGBA 255 and RGBA as percentages.
RGB validates and returns a new RGBColor object from the provided r, g, b values.
RGBA validates and returns a new RGBAColor object from the provided r, g, b, a values.
# Variables
ErrBadColor is the default bad color error.
# Interfaces
Color is the base color interface from which all others ascribe to.