CSS Color Mix Function
Blend colors dynamically using CSS color-mix function for creating tints shades and opacity variants at runtime.
Code
:root { --brand: #4f46e5; }
.button {
background: var(--brand);
border: 2px solid color-mix(in srgb, var(--brand) 80%, black);
}
.hover-bg {
background: color-mix(in srgb, var(--brand) 90%, white);
}Report a problem with this exampleOpens a pre-filled issue on GitHub.