Skip to main content
Apr 1, 2023 1:55 AM UTC
Solved

How can I count the times a property is used?

How can I create a plugin to count how many times a color, font-size, font-weight etc is used?

This topic has been closed for replies.
Gleb
GlebSolution
Power Member
Apr 8, 2023 2:14 AM UTC

You need to loop through the nodes and count what you need.

5 replies

Gleb
GlebSolution
Power Member
Apr 8, 2023 2:14 AM UTC

You need to loop through the nodes and count what you need.

Jun 19, 2023 3:27 PM UTC

Hi, for line-height, sometimes it is set to auto which is not what I want. Is there a way to get the line height from the inspects tab where it shows the line-height in pixels?

tank666
Jun 19, 2023 4:12 PM UTC

In the Inspect panel, you could also see the comment: /* identical to box height */.
Therefore: TextNode.lineHeight = TextNode.height.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Jun 19, 2023 6:31 PM UTC

thnks. and what if the text is mixed? or what if it is not identical to the box height?

tank666
Jun 19, 2023 9:14 PM UTC

As an option, you can create a new text object for each segment to get its height/line height.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank