Count Layers Figma Plugin

This is a small plugin that counts layers in a selection and specifies how many of them are selected directly (so-called top-level elements) or entirely hidden.

This information can be useful in the process of optimising the file and creating scalable and performant design system.

Another potentially useful feature of this plugin is that it logs to the console how many layers of different kinds are presented in the selection. In practice, it looks something like this (see the types property):

    "total": 298,
    "hidden": 32,
    "topLevel": 47,
    "types": {
        "RECTANGLE": 71,
        "COMPONENT": 2,
        "TEXT": 50,
        "INSTANCE": 24,
        "GROUP": 21,
        "FRAME": 73,
        "VECTOR": 51,
        "ELLIPSE": 6

This information is rarely needed but can be useful in some cases.