Color Chip Copy
A copy-paste color pickers component in pure HTML, CSS & vanilla JS. Zero dependencies, framework-agnostic, MIT-licensed.
Color PickersHTMLJavaScriptCSSany framework
Copy into your project
HTML
<button class="nuda-cchip" data-hex="#9D6DFF">
<span class="nuda-cchip__swatch" style="background:#9D6DFF"></span>
<span class="nuda-cchip__hex">#9D6DFF</span>
<span class="nuda-cchip__copy">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" />
<path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" />
</svg>
</span>
</button>JavaScript
document.querySelectorAll('.nuda-cchip').forEach(chip => {
chip.addEventListener('click', async () => {
const hex = chip.dataset.hex || chip.querySelector('.nuda-cchip__hex').textContent;
try { await navigator.clipboard.writeText(hex); } catch {}
});
});CSS
.nuda-cchip {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 10px 6px 6px;
background: rgba(255,255,255,.04);
border: 1px solid rgba(255,255,255,.08);
border-radius: 99px;
color: #fafafa;
cursor: pointer;
font-family: ui-monospace,SFMono-Regular,Menlo,monospace;
font-size: 11px;
font-weight: 600;
transition: background .25s,border-color .25s,transform .2s;
}
.nuda-cchip:hover {
background: rgba(255,255,255,.07);
border-color: rgba(255,255,255,.16);
transform: translateY(-1px);
}
.nuda-cchip__swatch {
width: 18px;
height: 18px;
border-radius: 50%;
box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
}
.nuda-cchip__copy {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 50%;
background: rgba(255,255,255,.06);
color: #a0a0a8;
opacity: 0;
transform: scale(.7);
transition: opacity .2s,transform .25s,background .2s,color .2s;
}
.nuda-cchip__copy svg {
width: 11px;
height: 11px;
}
.nuda-cchip:hover .nuda-cchip__copy {
opacity: 1;
transform: scale(1);
}
.nuda-cchip__copy:hover {
background: #e4ff54;
color: #09090b;
}
How to use Color Chip Copy
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.