Skip to content
/ color Public

🎨 Color manipulation and format conversion

License

Notifications You must be signed in to change notification settings

gowww/color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gowww color GoDoc Build Coverage Go Report Status Stable

Package color provides color manipulation and format conversion.

Installing

  1. Get package:

    go get -u github.com/gowww/color
  2. Import it in your code:

    import "github.com/gowww/color"

Usage

From hexadecimal

To get a Color instance from an hexadecimal representation, use NewHex:

color.NewHex("#004bff")

From RGB

To get a Color instance from red, green and blue values, use NewRGB:

color.NewRGB(0, 75, 255)

To get a Color instance from red, green, blue and alpha values, use NewRGBA:

color.NewRGBA(0, 75, 255, .5)

To hexadecimal

To get the hexadecimal representation of a Color without alpha, use Color.Hex:

color.NewRGBA(0, 75, 255, .5).Hex() // "#004bff"

To get the hexadecimal representation of a Color with alpha, use Color.HexAlpha or Color.AlphaHex:

color.NewRGBA(0, 75, 255, .5).HexAlpha() // "#004bff7f"
color.NewRGBA(0, 75, 255, .5).HexAlpha() // "#7f004bff"

About

🎨 Color manipulation and format conversion

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages