Site improvements: mobile SVG performance and crayon wrapper contrast - #3
Open
andypbrowne wants to merge 2 commits into
Open
Site improvements: mobile SVG performance and crayon wrapper contrast#3andypbrowne wants to merge 2 commits into
andypbrowne wants to merge 2 commits into
Conversation
- Replace 120 full inline SVGs with a shared sprite and lightweight use references - Remove expensive feMorphology SVG filters that were costly on mobile GPUs - Move crayon color names from SVG text to HTML labels for faster rendering - Add content-visibility on list items so off-screen crayons skip layout work Co-authored-by: Andrew Paul Browne <andypbrowne@gmail.com>
Replace the generic #D9D9D9 wrapper with a per-crayon wrapper color computed at build time. Light crayons get a darker wrapper; dark crayons get a lighter one, targeting WCAG 3:1 contrast while preserving hue. Co-authored-by: Andrew Paul Browne <andypbrowne@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidates all in-progress site improvements into a single feature branch:
This replaces the separate PRs for mobile SVG performance and crayon wrapper contrast.
Mobile SVG performance
The homepage was shipping 120 full inline SVGs (~406 KB of HTML), each with duplicate path data and an expensive
feMorphologyfilter. That combination is especially slow on mobile browsers.This reduces the homepage HTML to ~91 KB (~77% smaller) while keeping the same crayon visuals.
<symbol>; each crayon uses a lightweight<use>reference plus its color path<text>nodescontent-visibility: autoon list items so off-screen crayons skip layout/paint until scrolled into viewCrayon wrapper contrast
Each crayon wrapper is no longer a generic gray (
#D9D9D9). The wrapper color is computed from the crayon tip color at build time:Light crayons get a darker wrapper
Dark crayons get a lighter wrapper
Target contrast ratio: WCAG 3:1 (the standard for graphical UI components)
Added
utils/crayon-wrapper-color.jswith WCAG relative luminance and contrast calculationsAdded an Eleventy
crayonWrapperfilterMoved the wrapper body path out of the shared sprite and into each per-crayon SVG with
{{ crayon.hex | crayonWrapper }}Test plan
npm run build)