Skip to content

Alpha Channel Slider

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

Color PickersHTMLCSSany framework
72%

Copy into your project

HTML
<div class="nuda-cpk2-alpha-slider">
  <label id="cpk2-alpha-slider-label" for="cpk2-alpha-slider-input">Alpha</label>
  <div class="nuda-cpk2-alpha-slider__track">
    <input id="cpk2-alpha-slider-input" class="nuda-cpk2-alpha-slider__input"
           type="range" min="0" max="100" value="72"
           aria-labelledby="cpk2-alpha-slider-label"
           aria-valuetext="72 percent opacity">
  </div>
  <span class="nuda-cpk2-alpha-slider__val" aria-live="polite">72%</span>
</div>
CSS
.nuda-cpk2-alpha-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  width: 100%;
  max-width: 240px;
}

.nuda-cpk2-alpha-slider label {
  font-size: 10px;
  color: #777;
  width: 32px;
}

.nuda-cpk2-alpha-slider__track {
  position: relative;
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
}

.nuda-cpk2-alpha-slider__track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 10px;
  border-radius: 99px;
  transform: translateY(-50%);
  background: repeating-conic-gradient(#3a3a3a 0 25%,#1c1c1c 0 50%) 0 0/10px 10px;
}

.nuda-cpk2-alpha-slider__track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 10px;
  border-radius: 99px;
  transform: translateY(-50%);
  background: linear-gradient(90deg,rgba(98,182,255,0),#62b6ff);
}

.nuda-cpk2-alpha-slider__input {
  position: relative;
  z-index: 1;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  cursor: pointer;
}

.nuda-cpk2-alpha-slider__input::-webkit-slider-runnable-track {
  height: 10px;
  background: transparent;
}

.nuda-cpk2-alpha-slider__input::-moz-range-track {
  height: 10px;
  background: transparent;
}

.nuda-cpk2-alpha-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fafafa;
  border: 2px solid #0c0c10;
  box-shadow: 0 0 0 1px rgba(255,255,255,.4);
  cursor: grab;
  transition: transform .2s;
}

.nuda-cpk2-alpha-slider__input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.nuda-cpk2-alpha-slider__input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fafafa;
  border: 2px solid #0c0c10;
  cursor: grab;
}

.nuda-cpk2-alpha-slider__input:focus-visible {
  outline: none;
}

.nuda-cpk2-alpha-slider__input:focus-visible::-webkit-slider-thumb {
  outline: 2px solid #e4ff54;
  outline-offset: 2px;
}

.nuda-cpk2-alpha-slider__val {
  width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #fafafa;
  font-weight: 700;
  font-size: 11px;
}

@media (prefers-reduced-motion:reduce) {
  .nuda-cpk2-alpha-slider__input::-webkit-slider-thumb {
    transition: none;
  }
}

How to use Alpha Channel Slider

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