Skip to content

Contrast Pair

A copy-paste color pickers component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Color PickersHTMLCSSany framework
Aa
12.4:1
AAAAA

Copy into your project

HTML
<div class="nuda-contrast">
  <div class="nuda-contrast__demo"><span>Aa</span></div>
  <div class="nuda-contrast__info">
    <div class="nuda-contrast__ratio">12.4:1</div>
    <div class="nuda-contrast__badges">
      <span class="is-pass">AA</span>
      <span class="is-pass">AAA</span>
    </div>
  </div>
</div>
CSS
.nuda-contrast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  width: 100%;
  max-width: 200px;
}

.nuda-contrast__demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: #e4ff54;
  color: #09090b;
  border-radius: 9px;
  font-size: 18px;
  font-weight: 700;
  font-family: Georgia,serif;
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}

.nuda-contrast:hover .nuda-contrast__demo {
  transform: scale(1.08) rotate(-4deg);
}

.nuda-contrast__ratio {
  color: #fafafa;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.nuda-contrast__badges {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.nuda-contrast__badges span {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  font-family: ui-monospace,SFMono-Regular,Menlo,monospace;
  background: rgba(255,94,122,.12);
  color: #ff5e7a;
  border: 1px solid rgba(255,94,122,.25);
}

.nuda-contrast__badges span.is-pass {
  background: rgba(110,231,183,.12);
  color: #6ee7b7;
  border-color: rgba(110,231,183,.25);
  animation: _passPop .4s cubic-bezier(.34,1.56,.64,1);
}

@keyframes _passPop {
  0% {
    transform: scale(.5);
  }
  60% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-contrast__badges span.is-pass {
    animation: none;
  }
}

How to use Contrast Pair

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More color pickers components

← Browse all NudaUI components