Skip to main content
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?

Best answer by Gleb

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

View original
This topic has been closed for replies.

5 replies

Gleb
  • Power Member
  • 4708 replies
  • Answer
  • April 8, 2023

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


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
  • 4873 replies
  • June 19, 2023

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


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


tank666
  • 4873 replies
  • June 19, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings