[wp-trac] [WordPress Trac] #48798: REST API: Expose editor-color-palette theme support in /themes endpoint

WordPress Trac noreply at wordpress.org
Sat Nov 30 08:58:04 UTC 2019


#48798: REST API: Expose editor-color-palette theme support in /themes endpoint
-------------------------+-----------------------
 Reporter:  koke         |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  5.4
Component:  REST API     |     Version:  5.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  rest-api
-------------------------+-----------------------

Comment (by koke):

 Added an updated patch, here's the API output for quick reference:


 {{{
 $ http -ba admin:password http://localhost:8889/wp-json/wp/v2/themes
 status==active
 [
     {
         "theme_supports": {
             "disable-custom-colors": false,
             "disable-custom-font-sizes": false,
             "editor-color-palette": [
                 {
                     "color": "#cd2653",
                     "name": "Accent Color",
                     "slug": "accent"
                 },
                 {
                     "color": "#000000",
                     "name": "Primary",
                     "slug": "primary"
                 },
                 {
                     "color": "#6d6d6d",
                     "name": "Secondary",
                     "slug": "secondary"
                 },
                 {
                     "color": "#dcd7ca",
                     "name": "Subtle Background",
                     "slug": "subtle-background"
                 },
                 {
                     "color": "#f5efe0",
                     "name": "Background Color",
                     "slug": "background"
                 }
             ],
             "editor-font-sizes": [
                 {
                     "name": "Small",
                     "shortName": "S",
                     "size": 18,
                     "slug": "small"
                 },
                 {
                     "name": "Regular",
                     "shortName": "M",
                     "size": 21,
                     "slug": "normal"
                 },
                 {
                     "name": "Large",
                     "shortName": "L",
                     "size": 26.25,
                     "slug": "large"
                 },
                 {
                     "name": "Larger",
                     "shortName": "XL",
                     "size": 32,
                     "slug": "larger"
                 }
             ],
             "formats": [
                 "standard"
             ],
             "post-thumbnails": true,
             "responsive-embeds": false
         }
     }
 ]
 }}}

 It looks like twenty nineteen adds a `shortName` field when registering
 the font sizes, which is not part of the schema. I'm not sure if I should
 filter the output to only those properties defined in the schema or it's
 fine to leave that in the response.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48798#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list