Answered

Setting Color through REST API

  • 11 July 2020
  • 6 replies
  • 1150 views

Userlevel 2

I’m trying to set the color of a sticker using the REST API, but not having much luck.  When I set style.backgroundColor to any value other than “#fff9b1” I get an result of error code 400 (Bad Request).  Are there only certain allowed values?  Could these be specified in the documentation?

icon

Best answer by Steve Appling 12 July 2020, 19:51

View original

6 replies

Userlevel 1
Badge

I wonder why the shapes can't format html links?

And why text objects are the only ones that support bullet points and highlighting.
Just seems that all the objects types should support the same rich text features that text has and they would simply add new features and additional properties..

Userlevel 1
Badge

Also, the shapes do not allow named colors: Uncaught Error: "style.fillColor" is invalid value "YELLOW"
    at O.responseHandler (miro.js?v=458081:1:3286)

 

But the text objects do...

Userlevel 1
Badge

Having background without having font color is sort of limiting…

I'm color blind and I don't mind red with white text but i can't use red if I can't change the font to white.

Black text on red background isn't readable for me, unfortunately, so I have to use the lighter colors only since I can't color text yet with the API… https://beta.developers.miro.com/docs/text_text-1#style

Hey guys, regarding this topic I have an additional question.

Why there are only 12 values available, even if we can set 16 colors from UI?

EDIT:
I checked colors available from UI and in REST API and it seems 7 out of 16 UI colors don’t work through API:

```

  Grey = '#f5f6f8',

  Yellow = '#fff9b1',

  Orange = '#f5d128',

  IntenseOrange = '#ff9d48',

  Lime = '#d5f692',

  // Green = '#c9df56', // Not working

  // BottleGreen = '#93d275', // Not working

  Turquoise = '#67c6c0',

  Pink = '#ffcee0',

  IntensePink = '#ea94bb',

  // Purple = '#be88c7', // Not working

  Red = '#f16c7f',

  // Blue = '#a6ccf5', // Not working

  // Aqua = '#6cd8fa', // Not working

  // Violet = '#7b92ff', // Not working

  // Black = '#000000', // Not working
```

It feels like a bug...

Userlevel 2
Badge

Thanks a lot @Steve Appling. You are right, it was missed and we will add to our documentation.

Userlevel 2

Okay - I think I have figured this out and am posting here for other’s reference.

If you are creating a sticker, you can only set the color value to one of 12 specific values:

  1. GREY =         "#f5f6f8"
  2. YELLOW =       "#fff9b1"
  3. LIGHT_ORANGE = "#f5d128"
  4. OLIVE =        "#d0e17a"
  5. GREEN =        "#d5f692"
  6. PASTEL_BLUE =  "#a6ccf5"
  7. AQUA =         "#67c6c0"
  8. BLUE =         "#23bfe7"
  9. ORANGE =       "#ff9d48"
  10. PINK =         "#ea94bb"
  11. RED =          "#f16c7f"
  12. PURPLE =       "#b384bb"

This really should be documented.  Other widgets (like Cards) seem to be able to take a wider range of colors.

Reply