How to get total external styles count?


I’m trying to get a sense of how many styles from my DS file are being used in a given Figma file. I’m creating a plugin for my own use to get that data so I can store it in a file of my own through console.log.

I noticed that textStyleId and fillStyleId are often Figma.mixed typed, which means I can’t know exactly how many types are inside.

Is there a way to understand how many unique styles are returned when we have a Figma.mixed type being returned?

I noticed that going to fills or any other styling arrays doesn’t help, since there are no ids in there.


PS: using Figma own features is not the purpose here, but thanks anyway if that’s your idea. :slight_smile: I’d really appreciate help in code.

Hello there, Thank you for getting in touch about this!

I have moved your topic to the Plugin and Widget API category where you can connect with other developers who may have insights.
I’ll contact our internal team to see if we can provide any assistance. We will keep you updated once we have any information.

Also, we welcome any insights or suggestions from other community members!

Thank you,

1 Like

Hi! Figma engineer here - You can call getStyledTextSegments with textStyleId and fillStyleId : getStyledTextSegments | Plugin API

Alternatively, you can call getRangeTextStyleId and getRangeFillStyleId on each character: TextNode | Plugin API

1 Like