Skip to content
moxon home

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.

gethttps://api.moxon.dev/v4/color
Try itget/v4/color

Parameters

  • hexstringoptional

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

Response Fields

  • hexstring

    Hexadecimal color code

  • rgbstring

    RGB color format

  • hslstring

    HSL color format (Hue, Saturation, Lightness)

  • hsvstring

    HSV color format (Hue, Saturation, Value)

  • hwbstring

    HWB color format (Hue, Whiteness, Blackness)

  • cmykstring

    CMYK color format (Cyan, Magenta, Yellow, Key/Black)

Code Examples

Error Handling

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

  • 400Invalid HEX color (use #RRGGBB)The hex parameter is not valid hex