Skip to content

golang library for generating random hex color codes

License

Notifications You must be signed in to change notification settings

frankenbeanies/randhex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

randhex

Build Status Coverage Status Go Report Card GoDoc

A library for generating random hexadecimal color codes

License

MIT

Installation

$ go get github.com/frankenbeanies/randhex

Usage

import "github.com/frankenbeanies/randhex

Methods

New()

Generates a new random hexadecimal color code (RandHex)

hex := randhex.New()

String()

Provides a string representation of the RandHex prepended with '#'

hexStr := randhex.New().String()

Bytes()

Provides the byte representation of the RandHex

hexBytes := randHex.New().Bytes()

ParseString()

Parses string into a RandHex

hex, _ := randhex.ParseString("#aaa")
hex, _ := randhex.ParseString("#AAAAAA")
hex, _ := randhex.ParseString("aaa")
_, err := randhex.ParseString("a") //error, bad length
_, err := randhex.ParseString("%aaa") //error, bad symbol
_, err := randhex.ParseString("#gaa") //error, not hex

About

golang library for generating random hex color codes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages