I’m currently creating a codegen plugin and I need to get the , here is what I mean by “typography’s name” in edit mode:
I can get all the other data but not its name, which is what I actually need 🥲
I’m currently creating a codegen plugin and I need to get the , here is what I mean by “typography’s name” in edit mode:
I can get all the other data but not its name, which is what I actually need 🥲
Thanks for the quick reply but they are not actually the same, name
seems to refer to the node’s name as seen above the node and in the console (node.name
) on this screenshot:
But i’m actually looking for the typography’s name, Desktop/Headings/H4
in the screenshot
It’s because you didn’t get the style. To get the style you need to use the getStyleById
method.
Oh I see, thanks a lot!
For anyone stumbling upon this issue, here’s a minimal example:
figma.codegen.on("generate", async (e: CodegenEvent) => {
const node = e.node;
if (node.type === "TEXT") {
console.log(figma.getStyleById(node.textStyleId).name);
}
})
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.