Skip to content

Palette

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

Parameters

ParameterRequiredDescription
colorYesBase color in HEX format (#RRGGBB)
typeYesPalette type (see below)

Palette Types

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

Response Fields

FieldTypeDescription
base.hexstringBase color in HEX
base.rgbstringBase color in RGB
base.hslstringBase color in HSL
typestringPalette type used
colorsarrayGenerated colors
colors[].hexstringColor in HEX format
colors[].rgbstringColor in RGB format
colors[].hslstringColor in HSL format

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v4/palette?color=%23ff6600&type=triadic"

Try It

Error Handling

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

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