devtools
devtools copied to clipboard
Icon identifier
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?
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
.