Mike Gifford

Mike Gifford
Photos were taken at the State of Open Con 25. I am wearing a CivicActions jacket and T-Shirt. Photographer: Tiana Lea.

View the Project on GitHub: mgifford/ox.ca

Druplicon Sprite Build Summary

Completion Report

Successfully built SVG sprite with greyscale-preserving color normalization

Statistics

Technical Implementation

Color Normalization Algorithm

For 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.

Example Transformations

File Handling

Dark/Light Mode Compatibility

Icons 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.

Usage in Presentations

As Watermark

<svg class="watermark" style="opacity: 0.1;">
  <use href="ca-slides/assets/drupal/druplicon-sprite.svg#druplicon-drupal-hero_drupal-20hero"/>
</svg>

Inline Icon

<svg width="50" height="50">
  <use href="ca-slides/assets/drupal/druplicon-sprite.svg#druplicon-a11y_druplicon-a11y"/>
</svg>

Sample Icons Available

See druplicon-manifest.txt for the complete list.

Testing

Open demo.html in a browser to see:

Regeneration

To rebuild the sprite after adding new images:

cd /Users/mgifford/ox.ca
python3 scripts/build_druplicon_sprite.py

The script will:

  1. Scan presentations/ca-slides/assets/drupal/originals/
  2. Skip duplicates (SHA1 hash comparison)
  3. Normalize colors with greyscale preservation
  4. Embed raster images
  5. Output sprite + manifest

Performance Notes

Next Steps (Optional)

  1. Optimize rasters: Convert large PNGs/JPGs to SVG via tracing
  2. Split sprite: Separate raster and vector versions
  3. Lazy loading: Load sprite on-demand for presentations
  4. CDN: Host on fast CDN for presentation performance