Skip to content

CSS accent-color Not Applied Fix

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about CSS accent. We cover key concepts, practical examples, and best practices.

The Problem

The accent-color CSS property tints form controls like checkboxes, radio buttons, and range sliders. When it appears not to apply, the element may not support the property, a more specific selector overrides it, or the control is using a custom appearance that blocks the accent color.

Quick Fix

Step 1: Apply accent-color to the right element

/* Wrong — applied to a non-form element */
.card {
    accent-color: blue;
}

/* Right — apply to form controls */
input[type="checkbox"] {
    accent-color: #6366f1;
}

input[type="radio"] {
    accent-color: #6366f1;
}

input[type="range"] {
    accent-color: #6366f1;
}

progress {
    accent-color: #6366f1;
}

Step 2: Reset appearance to use accent-color

/* Wrong — appearance: none removes accent-color */
input[type="checkbox"] {
    appearance: none;
    accent-color: #6366f1;
}

/* Right — let the browser handle the control appearance */
input[type="checkbox"] {
    accent-color: #6366f1;
}

/* Or use appearance: auto explicitly */
input[type="checkbox"] {
    appearance: auto;
    accent-color: #6366f1;
}

Step 3: Use accent-color with color-scheme

/* Wrong — accent-color may be overridden by dark mode */
input {
    accent-color: #6366f1;
}

/* Right — combine with color-scheme for consistency */
:root {
    color-scheme: light dark;
}

input[type="checkbox"] {
    accent-color: #6366f1;
}

/* Dark mode override */
@media (prefers-color-scheme: dark) {
    input[type="checkbox"] {
        accent-color: #818cf8;
    }
}

Step 4: Check selector specificity

/* Wrong — low specificity, easily overridden */
input {
    accent-color: blue;
}

/* Global style sheet */
input[type="checkbox"] {
    accent-color: red; /* Overrides blue */
}

/* Right — use specific selector with matching specificity */
input[type="checkbox"].custom-checkbox {
    accent-color: #6366f1;
}

/* Or use !important (last resort) */
input[type="checkbox"] {
    accent-color: #6366f1 !important;
}

Step 5: Verify browser support

/* Wrong — no fallback for unsupported browsers */
input[type="checkbox"] {
    accent-color: #6366f1;
}

/* Right — provide background-color fallback */
input[type="checkbox"] {
    accent-color: #6366f1;
    /* Browsers that support accent-color use it */
    /* Browsers that don't, show default colors */
}

Prevention

  • Apply accent-color directly to <input> and <progress> elements
  • Keep appearance: auto (the default) on form controls
  • Combine with color-scheme for consistent dark mode support
  • Use specific selectors to avoid specificity conflicts
  • Test checkboxes, radio buttons, and range sliders separately

Common Mistakes with accent color

  1. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  2. Misunderstanding that String is [Char] with poor performance for large text operations
  3. Using foldl instead of foldl' causing stack overflow on large lists

These mistakes appear frequently in real-world CSS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Which elements support accent-color?

input[type="checkbox"], input[type="radio"], input[type="range"], and progress elements. Other form controls like text inputs, selects, and buttons do not support accent-color — use standard CSS properties instead.

Can I apply accent-color globally?

Yes. Use input { accent-color: #6366f1; } to style all supported form controls. Each control type uses the accent color for its interactive parts — check fill, radio dot, range thumb, and progress bar.

Does accent-color affect focus styles?

No. accent-color only changes the checked/active state color. Focus styles remain controlled by :focus-visible and outline. Use both properties together for complete form control styling.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro