styleRange has empty fill

Correct me if I’m wrong but I thought that fill:!Color stands for not nullable value. I recently faced a problem that layer might have empty text value and fill in styleRange is null. I didn’t manage to reproduce it using XD itself but maybe it’s an api issue.

Could you clarify what you mean by “empty text value”? if the text is deleted and there is only the cursor showing, you could see the styleRanges value being null

Layer properties look like this:

  "_type": "Text",
  "text": "",
  "styleRanges": [
      "length": 0,
      "linkId": "",
      "fontFamily": "Arial",
      "fontStyle": "Regular",
      "fontSize": 10,
      "charSpacing": 0,
      "underline": false,
      "textTransform": "none",
      "textScript": "none",
      "fill": null,
      "strikethrough": false

If the style run is zero-length, you should probably ignore all the other values.

It’s just a placeholder of some sort, like the .fill and .stroke properties when those aren’t enabled.

I’m not sure about zero-length run as the run length might be zero for the last element in the collection of runs as well. My point is more about fill which can’t be null (according to the documentation) but really it’s nullable.

Again, that zero-length run probably shouldn’t be relied on for any actual values.

Did you read my reply?

  1. Zero length run might be last element in the collection of runs and it contains correct values which should be applied for the rest of the symbols (per documentation).
  2. There is nothing in documentation about tricks with zero-length run, specifically it doesn’t say that fill is always not null except some cases which are not covered by the documentation.