How to get all colors used in document except searching by layer? Searching every layer costs too much time when the document is large. Is there any better way?
Unfortunately I don’t think so. You can get Assests like document colors and whatnaught really easily but if you want all colors used in a document I believe you will need to loop through all the layers like this:
or use Sketch.find in a clever way
There might be some way to hook into some private methods like MSColorReplacement or something but I’m not too sure https://github.com/abynim/Sketch-Headers/blob/382beaa961f3f1bc4e1abbeca40bc1333176bc83/Headers/MSColorReplacement.h