Color scheme

Forms and Token Review

This reading covers two topics. The first is a pair of modern CSS properties that simplify form styling without replacing native controls with custom markup. The second is a mid-course audit of the token files you have been building since Unit 2. Both feed directly into the assignment that follows, where you will apply these form properties to your portfolio and tighten your token system before the final units.

Theming Native Controls with accent-color

For years, styling a checkbox or radio button meant hiding the native control and rebuilding it from scratch with ::before pseudo-elements, background images, or wrapper divs. The result was fragile, often broke keyboard navigation or screen reader announcements, and had to be maintained separately from the rest of the design. The accent-color property skips all of that. It tells the browser which color to use for the interactive parts of its built-in form controls: the filled state of a checkbox, the dot in a radio button, the thumb and filled track of a range slider, and the filled portion of a progress bar.


        :root {
            accent-color: var(--color-accent);
        }
    

That single declaration on the root element recolors every native checkbox, radio, range, and progress bar on the site to your brand accent. Because it inherits, you can also set it on a specific container to theme a form differently from the rest of the page. The browser handles contrast automatically, adjusting the checkmark or dot color against your chosen fill so it stays readable.

Support is universal across Chrome, Edge, Firefox, and Safari. See Can I Use: accent-color. The property degrades gracefully in any environment that does not support it: controls simply render in the browser's default blue.

Auto-Growing Textareas with field-sizing

A standard <textarea> is a fixed rectangle. You set its height with the rows attribute or with CSS, and if the user types more than that, the overflow scrolls inside the box. The box itself never changes size, which wastes space when the user types one line and hides content when they type twenty.

The field-sizing: content property changes this behavior. The textarea starts at the size of its content and grows taller as the user types more lines, the way a chat input in a messaging app expands to fit what you are writing. Pair it with min-height and max-height to set guardrails so the box never collapses to zero when empty and never grows past a comfortable limit.


        textarea {
            field-sizing: content;
            min-height: 3lh;
            max-height: 10lh;
        }
    

This is a very new property. As of this writing, Chrome, Edge, and Safari (from version 26.2) support field-sizing: content, but Firefox does not yet. Check Can I Use: field-sizing for the current picture. Treat it as a progressive enhancement: in browsers that do not support it, the textarea falls back to its normal fixed-height behavior, which is perfectly functional. Nobody loses access to the form; the experience is simply less refined.

Seeing Both Properties

The demo below shows a small form panel with native controls. Pick a color at the top and every control on the panel picks up that accent. The textarea at the bottom uses field-sizing: content in browsers that support it: type several lines and watch it grow, then delete them and watch it shrink back. In browsers without support, it behaves as a normal fixed textarea.

accent-color: #006eb6
Checkboxes
Radio buttons
Range slider
Textarea (field-sizing: content)

Token Sprawl and What Healthy Tokens Look Like

A token file that grows over many assignments without ever shrinking develops a pattern called sprawl. Every unit adds new tokens for the features it introduces, but nothing removes the tokens that an earlier design decision made obsolete. Naming conventions evolve as you learn better patterns, and the old names sit alongside the new ones rather than being replaced. The file still works, but it carries dead weight and ambiguity that compounds with each addition.

Here is what sprawl looks like in practice. Notice the overlapping spacing values, the dead token nobody references, and the two naming conventions coexisting:


        :root {
            /* Two spacing values one pixel apart, used interchangeably */
            --spacing-sm: 10px;
            --spacing-card: 11px;
 
            /* Old naming convention still present */
            --text-sm: 1.4rem;
 
            /* New naming convention introduced later */
            --font-size-sm: 1.4rem;
 
            /* Defined once, never referenced anywhere */
            --color-highlight: #fef3c7;
        }
    

A healthy token file has none of these problems. Every token is consumed by at least one rule. Scale steps are clearly spaced with no near-duplicates that make choosing between them ambiguous. One naming convention runs through the entire file. Compare the same set of tokens after tightening:


        :root {
            /* One spacing step, clear purpose */
            --spacing-sm: 10px;
 
            /* One naming convention throughout */
            --font-size-sm: 1.4rem;
 
            /* highlight removed: no consumer existed */
        }
    

The three signs to watch for are orphan tokens (declared but never consumed), near-duplicate values (two tokens within a pixel of each other used in similar contexts), and naming drift (two conventions for the same concept, such as --text-* and --font-size-* both meaning font size). These are natural byproducts of iterative work, not mistakes. Every design system team deals with them, and the difference between a maintainable system and a messy one is whether they are caught and cleaned up periodically.

Putting It Together

The form properties and the token audit target different parts of your portfolio but share a theme: getting more from less. One line of accent-color replaces dozens of lines of custom checkbox CSS. One field-sizing declaration replaces a JavaScript resize observer. And a tightened token file with no dead entries, no near-duplicates, and consistent names is easier to maintain, easier for a teammate to read, and easier to extend in the final units. The assignment that follows asks you to apply both.