✅ Successfully built SVG sprite with greyscale-preserving color normalization
druplicon-sprite.svg - Single sprite with all iconsdruplicon-manifest.txt - ID-to-filename mappingSPRITE-USAGE.md - Integration guidedemo.html - Interactive demonstrationFor each SVG fill/stroke color:
1. Parse color (hex, rgb(), named colors)
2. Calculate luminance: L = 0.2126×R + 0.7152×G + 0.0722×B
3. Normalize to 0-1 range: luminance = L / 255
4. Replace: fill="#RRGGBB" → fill="currentColor" opacity="0.XXX"
This preserves the greyscale information in the opacity value while allowing the actual color to be controlled via CSS color property.
currentColor + opacity=”0.000”currentColor + opacity=”0.502”currentColor + opacity=”1.000”currentColor + opacity=”0.347”<image> elementsIcons automatically adapt to theme color:
/* Light mode */
.slide { color: #000; }
/* Dark mode */
.slide { color: #fff; }
The greyscale values (opacity) remain constant, but the base color changes, creating perfect theme adaptation.
<svg class="watermark" style="opacity: 0.1;">
<use href="ca-slides/assets/drupal/druplicon-sprite.svg#druplicon-drupal-hero_drupal-20hero"/>
</svg>
<svg width="50" height="50">
<use href="ca-slides/assets/drupal/druplicon-sprite.svg#druplicon-a11y_druplicon-a11y"/>
</svg>
druplicon-angry-drop_angry - Angry druplicondruplicon-a11y_druplicon-a11y - Accessibility variantdruplicon-drupal-hero_drupal-20hero - Hero variantdruplicon-druplicon-batman_druplicon-batman - Batman druplicondruplicon-druplicon-angel_druplicon-angel - Angel druplicondruplicon-composer - Composer logo variantdruplicon-drupal-europe-2018 - DrupalCon Europedruplicon-bootstrap-paragraphs - Bootstrap integrationSee druplicon-manifest.txt for the complete list.
Open demo.html in a browser to see:
To rebuild the sprite after adding new images:
cd /Users/mgifford/ox.ca
python3 scripts/build_druplicon_sprite.py
The script will:
presentations/ca-slides/assets/drupal/originals/<use> with external refs)