Skip to content

Color Generation ​

The /color endpoint generates a color in multiple formats. You can provide a HEX color to convert, or omit it to get a random color.

Parameters ​

ParameterRequiredDescription
hexNoA HEX color to convert (e.g. ff6600). Random if omitted

Response Fields ​

FieldTypeDescription
hexstringHexadecimal color code
rgbstringRGB color format
hslstringHSL color format (Hue, Saturation, Lightness)
hsvstringHSV color format (Hue, Saturation, Value)
hwbstringHWB color format (Hue, Whiteness, Blackness)
cmykstringCMYK color format (Cyan, Magenta, Yellow, Key/Black)

Code Examples ​

curl -X GET \
  "https://api.sylvain.sh/v6/color?hex=1a1a2e"

Try It ​

Error Handling ​

If parameters are invalid, the API will return an error:

Error MessageDescription
Invalid HEX color (use #RRGGBB)The hex parameter is not valid hex