color calculations and conversions for every-day use
This provides some 'every-day' color calculation and conversions that allows easier color discovery, matching and handling.
- convert HEX to sRGB
- convert sRGB to HEX
- convert sRGB to XYZ
- convert sRGB to HSL
- convert XYZ to Lab*
- calculate distance (delta E) between two Lab* colors
- calculate WCAG contrast ratio between to sRGB colors
Example
a := NewRGB(120, 120, 12).ToXYZ().ToLAB()
b := NewRGB(230, 123, 40).ToXYZ().ToLAB()
deltaE := a.DistanceTo(b)
This CLI accepts two CSV files (a 'source' collection of available colors; a 'match' which contains the colors you try to match) – with format: collection(string),name(string),lrv(float64),r(float64),g(float64),b( float64) – which then are compared concurrently and outputs the top 10 closest colors in respect to the match CSV file.
Example
$ go run ./cmd/match -match my-colors.csv -source colors_available.csv -no-header -filter *available_name_filter_regex*
This CLI accepts two HEX color codes and returns the delta E value of both colors.
This CLI accepts a HEX color code and returns a ready-to-use RGB snippet for CSS.
This CLI accepts three parameters (R, G, B) and convert them to a ready-to-use HSL snippet for CSS.
This CLI accepts three parameters (R, G, B) and converts them to a ready-to-use HEX color code.
This CLI accepts two HEX color codes and returns the WCAG contrast ratio + if it succeeds the required 7:1 ratio.