REST APIeasy-svg-pro/v1/styles/colours

easy-svg-pro/v1/styles/colours

Reads the colours an icon draws with, or maps each of them to a theme colour.

REST endpoint · Easy SVG Pro · Status: Internal · Defined in includes/styles/styles.php

Internal: not part of the promised public surface. It may change without notice.

Usage

GET | POST /wp-json/easy-svg-pro/v1/styles/colours

Example

curl -X GET "https://example.com/wp-json/easy-svg-pro/v1/styles/colours?icon=acme/logo" \
	-H "X-WP-Nonce: $NONCE" -b "$COOKIES"

curl -X POST "https://example.com/wp-json/easy-svg-pro/v1/styles/colours" \
	-H "X-WP-Nonce: $NONCE" -b "$COOKIES" \
	-H "Content-Type: application/json" \
	-d '{"icon": "acme/logo", "colours": {"#0a2540": "primary"}}'

Description

GET returns the distinct hex fill and stroke colours found in the icon's unstyled markup. POST stores a colour map for one icon: keys are hex colours from the drawing, values are a palette slug or a hex value; invalid pairs are dropped and the icon keeps its template. Both answer 400 easy_svg_pro_no_icon for a reference that is not collection/slug.

Permission: manage_options and an active licence with the Styles & theme colors feature switched on under Icons, Features.

Parameters

query
iconstring
Required

The icon reference, as collection/slug. A query parameter for GET, a body field for POST.

body
coloursobject

POST only: map of a drawn hex colour to a palette slug or hex value. Not declared in the route schema, read from the JSON body.

Return value

returnobject

GET: {icon, colours: ['#rrggbb']}. POST: the full style settings, same shape as GET /styles.

Response

GET: {icon, colours: ['#rrggbb']}. POST: the full style settings, same shape as GET /styles.

{
  "icon": "acme/logo",
  "colours": [
    "#0a2540",
    "#ffcc00"
  ]
}