Skip to content
moxon home

Palette

The /palette endpoint generates a harmonious color palette from a base HEX color.

gethttps://api.moxon.dev/v5/palette
Try itget/v5/palette

Parameters

  • colorstringrequired

    Base color in HEX format (#RRGGBB)

  • typestringrequired

    Palette type (see below)

    • complementary
    • triadic
    • analogous
    • tetradic
    • split-complementary

Palette Types

TypeColors Generated
complementary2 colors (opposite)
triadic3 colors (120°)
analogous5 colors (-60° to +60°)
tetradic4 colors (90°)
split-complementary3 colors

Response Fields

  • base.hexstring

    Base color in HEX

  • base.rgbstring

    Base color in RGB

  • base.hslstring

    Base color in HSL

  • typestring

    Palette type used

  • colorsarray

    Generated colors

  • colors[].hexstring

    Color in HEX format

  • colors[].rgbstring

    Color in RGB format

  • colors[].hslstring

    Color in HSL format

Code Examples

Error Handling

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

  • 400A base color is requiredThe color parameter is missing
  • 400A palette type is requiredThe type parameter is missing
  • 400Invalid HEX color (use #RRGGBB)The color format is invalid
  • 400Type must be one of: complementary, triadic, analogous, tetradic, split-complementaryInvalid palette type