Skip to content

Instantly share code, notes, and snippets.

@alexjlockwood
Created February 3, 2020 21:41
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save alexjlockwood/f6ca43a552bbb58fa129cc298f807859 to your computer and use it in GitHub Desktop.
Save alexjlockwood/f6ca43a552bbb58fa129cc298f807859 to your computer and use it in GitHub Desktop.
Prints nodes that have fill/stroke colors that aren't linked to a style.
figma.root.children
.flatMap(pageNode => pageNode.findAll(n => true))
.forEach(node => {
if ('fills' in node && 'fillStyleId' in node) {
if (node.fills !== figma.mixed && node.fills.length > 0 && node.fillStyleId !== '') {
print(`${node.name}'s fill color is not linked to a style`);
}
}
if ('strokes' in node && 'strokeStyleId' in node) {
if (node.strokes.length > 0 && node.strokeStyleId !== '') {
print(`${node.name}'s stroke color is not linked to a style`);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment