Background image pixelation on high‑DPI displays in Devicon
29.5K reputation · 26 Oct 2023, 09:25 UTC
Goal
Render Devicon icons sharply on high‑DPI screens without degrading performance or breaking existing markup.
Constraints & Uncertainty
Devicon’s current CSS uses a single‑resolution PNG sprite referenced as a background image. The library offers SVG files, but the documentation does not detail a fallback mechanism or automated switch for retina displays. The maintainers have considered a media‑query that loads a 2× PNG sprite when device‑pixel‑ratio > 1, but this logic is absent from the latest stable release.
Key Questions
- Should a media‑query be added to the CSS to load a 2× PNG sprite for high‑DPI devices, and what impact will that have on bundle size and load times?
- Would switching to inline SVG for all icons provide a more scalable solution, and how would that affect existing CSS class usage?
- How can we preserve backward compatibility with legacy projects that rely on the current background‑image approach while introducing retina support?