Open this example in the interactive library
Live preview
Source code
// components/HexTripletInspector.tsx
export default function HexTripletInspector({
hex = "#bc805a",
}: { hex?: string } = {}) {
const rgb = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
return (
<dl>
{["Red", "Green", "Blue"].map((c, i) => (
<div key={c}>
<dt>{c}</dt>
<dd>{rgb[i]}</dd>
</div>
))}
</dl>
);
}
