Color scheme

Accessible SVG Icon System

This assignment asks you to build a reusable inline SVG sprite from Lucide icons and integrate it into an existing page on your Practice Site. You are not building a new page from scratch. You are improving something that already exists with the <symbol> and <use> workflow from SVG Sprites and the accessibility patterns from SVG Accessibility.

Preparation

You will add a hidden sprite and icon markup to one page you have already built, plus a shared icon stylesheet in your components layer. When you are finished, your portfolio should include this structure:


    [portfolio]
    ├── css/
    │   ├── components/
    │   │   └── icons.css              # New
    │   └── main.css                       # Update
    ├── [your-chosen-page]/index.html          # Update
    ├── index.html                             # Update: Add Links
    └── README.md                              # Update: Pages

Choosing Your Page

Pick one existing portfolio page where at least five icons would feel earned. Strong candidates on most Practice Sites:

  • Homepage: Nav links, a hero CTA, or footer social links. Footer social icons are a classic icon-only link case.
  • CV or Resume: Contact rows (email, phone, location) and social or portfolio links (GitHub, LinkedIn). Often the richest icon opportunity on the site.
  • Motion dashboard: Nav links, action buttons, and card links you already styled with transitions.
  • Editorial or card grid: Category or status icons in card headers, arrows on card links.
  • Color tokens showcase: UI samples beside token swatches, plus an easy place to verify icon contrast in light and dark mode.

Pick one page. The goal is meaningful integration across at least five icons using at least two distinct accessibility patterns, not spreading thin across every page at once.

You Are Improving, Not Replacing

Do not restructure your chosen page's HTML significantly to make room for icons. If an icon fits naturally into existing markup, add it. If it requires inventing new content just to justify its presence, it probably does not belong there.

Assignment Instructions

1. Plan Your Icon Set

Before touching any code, identify at least five icons you will use and decide how each one will be treated accessibility-wise. Use the decision tree from SVG Accessibility to determine the correct pattern for each:

  • Is it decorative? It gets aria-hidden="true" and focusable="false".
  • Is it inside a button or link with visible text? Same as above. The text label covers it.
  • Is it inside an icon-only button or link? The button or link gets aria-label or visually hidden text. The SVG gets aria-hidden="true".
  • Is it a standalone informative image? It gets role="img", a <title> on the wrapper SVG, and aria-labelledby.

You must use at least two distinct accessibility patterns across your five icons. A page where every icon is decorative is not a sufficient demonstration of the skill.

2. Build the Inline Lucide Sprite

Go to Lucide, find each icon you planned, and click "Copy SVG" to get the markup. For each icon, create a <symbol> in your sprite with:

  • A descriptive, kebab-case ID like icon-arrow-right or icon-github.
  • viewBox="0 0 24 24": all Lucide icons share this coordinate space.
  • The path data from the copied SVG pasted inside the symbol. Copy only the inner paths, not the outer <svg> element.

Place the hidden sprite container as the first element inside <body> on your chosen page, as described in SVG Sprites:


    <svg xmlns="http://www.w3.org/2000/svg" style="display: none;" aria-hidden="true">
        <symbol id="icon-arrow-right" viewBox="0 0 24 24">
            <!-- paths from Lucide -->
        </symbol>
        <!-- more symbols -->
    </svg>

Reference an icon with <use> on a wrapper SVG. Put stroke presentation attributes on the wrapper, not only in CSS:


    <svg class="icon" viewBox="0 0 24 24" width="24" height="24"
         fill="none" stroke="currentColor" stroke-width="2"
         stroke-linecap="round" stroke-linejoin="round"
         aria-hidden="true" focusable="false">
        <use href="#icon-arrow-right"></use>
    </svg>

3. Add icons.css in the Components Layer

Create css/components/icons.css and import it through main.css. Lucide icons are stroke-based. Your stylesheet handles sizing and layout. Color comes from currentColor on the parent element's color property:


    .icon {
        display: inline-block;
        width: 1em;
        height: 1em;
        vertical-align: -0.125em;
        flex-shrink: 0;
    }

Apply class="icon" to every wrapper <svg> that references a symbol. Test that the icon color changes when you change the parent element's color property or toggle dark mode.

4. Integrate Icons on Your Chosen Page

Add your planned icons where they already belong: beside link text, inside buttons, in contact rows, or as icon-only controls with a proper label on the interactive element. Do not invent new sections just to host icons.

5. Verify Light and Dark Contrast

Your Practice Site has dark mode from the Tokenized Color System and Dark Mode assignment. Because icons inherit color via currentColor, they update when your color tokens shift. What you are checking is that each icon has sufficient contrast against its background in both modes.

In Chrome DevTools, open the Rendering panel and use "Emulate CSS media feature prefers-color-scheme" to toggle between light and dark without changing your OS setting. Visually verify each icon is clearly legible in both modes.

6. Apply Correct Accessibility Attributes

Go through each icon and apply the accessibility pattern you decided on in step 1. At minimum your integration must demonstrate:

  • At least one decorative icon with aria-hidden="true" and focusable="false".
  • At least one icon inside an icon-only interactive element (aria-label or visually hidden text on the button or link, aria-hidden="true" on the SVG).

7. Update Your Homepage and README

If you added icons to a page other than your homepage, make sure that page is still linked from your homepage. Update your README.md under the Pages section, following the same markdown list pattern from previous assignments.

8. Commit and Verify

Commit with a descriptive message, push, and verify the live site. Check that icons render at the correct size and color, that they update correctly in dark mode, and that icon-only interactive elements have a computed accessible name in DevTools (Accessibility panel → inspect each icon-only button and link).

Submission

Complete the report below with your site details and reflections. When you are finished, download the PDF and submit it to Canvas.

Accessible SVG Icon System Report
Site Details

My live accessible SVG icon page is at and the source code is at .

Reflection

Write a thoughtful response to each prompt. These are not summaries of what you did. They ask you to reason about why your icon and accessibility choices work the way they do on a real page.

Page Choice and Integration

Which page did you add icons to, and what made it the best candidate on your Practice Site? Describe how you integrated the sprite and at least five icons without restructuring the page around them.

Icon Accessibility and Contrast

Document every icon you added: Lucide name, location on the page, accessibility pattern, and why that pattern fits. Then describe your light and dark mode check in DevTools. Did any icon have a contrast problem in either mode, and how did you fix it?