- 🇷🇺Russia kostyashupenko Omsk
Bump
In 2023 year still the best we can do with icons - is to render them normally using
<svg>
. So vector graphic. (it's a question of which html tag to pick for rendering icons).How else we can improve rendering of svg? Use svg sprites (all icons loaded once, then cached by browser, good performance and extreme re-usability)
Also iconic font is a bad choice, because of:
1. bigger weight than svg sprite (even with woff2)
2. Blinking visual bugs - if your icon (made by iconic font) changes its color on hover for example, so when you will hover it - blinking effect
3. In comparison with svg - loss of quality on resize, but also worsen anti aliasing than svg spriteIf icon is not a vector image in 2023th year - we have already `image`, `responsive_image`, `media` for managing it. If it's not a vector image - it's not about svg anymore (obviously)
Comparing to CSS background-image - svg sprite is a winner again (even if in
data:image
format). Again - blinking on hover, bad anti aliasing.This issue is still actual for Drupal core, since more and more icons appearing.
What i'm thinking is next:
1. We should have new theme hook (or hooks) with twig, for rendering svg and svg_sprite technologies.
2. Then fix core themes, render icons via twig (instead of CSS background-image). Keep CSS related to icons only to manage colours and sizes of icons).
3. (optional for core) We should let user upload its vector icons through the admin back office. Ability to upload or choose a path to file which contains icons (for example if it's a svg-sprite - it's a single file containing all the icons inside). This functionality can be visible on Appearance page of the selected theme. - 🇪🇨Ecuador jwilson3
Probably we should update the issue summary to include more of this 👆 and less of the outdated approaches.
- 🇫🇷France pdureau Paris
Hi,
https://www.drupal.org/project/icon → last release was from March 2017, and last commit from June 2018.
Work on a Core API proposal for Icons is happening here: ✨ Add an icon management API Active Using other contrib module as starting points.