SketchAPI
SketchAPI copied to clipboard
Text.style.textColor is undefined
With this file, which is reported by my plugin user: text_color_undefined.sketch.zip
executing following in playground:
let document = sketch.getSelectedDocument();
let layer = document.pages[0].layers[0].layers[0];
console.log(
layer.name,
layer.style.textColor, //undefined
layer.style.fontFamily, //undefined
)
But the Text does have color and font family setting.
PS: I don't know how or in what version this Text is created. I just copied it from user's file.
PS: More information from json, the textStyle is missing. But should the api handle this correctly?
It's odd, after manually setting the font again it logs the correct info:
进行中 #1188eeff PingFang SC
Script executed in 0.088456s
It might be related to how the document was created?
Sorry, I have no further information. But while the Sketch handles this correctly, may be the API should do it right too.