devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Icon identifier

Open photodow opened this issue 4 years ago • 1 comments

Can we build a feature into the specs section, that will look at icons and determine whether it's custom or part of the IDL/Carbon icon library? Maybe there is some sort of check to make sure it's the right size for the font size?

photodow avatar Oct 01 '20 17:10 photodow

In addition, maybe a component list would be worthwhile too... Here is a potential way to identify the icons in the wild.

function findPictogram (pictogramName) {
  return [...document.querySelectorAll('svg')].filter(pictogram => {
        const title = pictogram.querySelector('title');

        return title && title.textContent.toLowerCase() === pictogramName.toLowerCase();
    });
}

A much heavier option might be to render each icon to html, and use regex to search the a string of the DOM like document.body.innerHTML.

photodow avatar Sep 22 '21 05:09 photodow