🎨 Color Shade & Tint Generator

Mix a base colour with white for lighter tints and with black for darker shades to build a coordinated ladder for buttons and backgrounds.

📐 工作原理与说明
tint = C·(1−t) + 255·t;shade = C·(1−t) + 0·t(t 为混合比例,0 ≤ t ≤ 1)
线性模式在 sRGB 各通道直接混入白/黑;感知模式转到 OKLCH,仅按感知明度 L 取等步长并保留色相,明度更均匀、避免中段发灰。OKLCH 结果超出 sRGB 色域时按 CSS Color 4 方式裁剪到可显示范围,并标注发生裁剪的色卡;色卡同时给出与白/黑文字的对比度。
设计变量(CSS 自定义属性) 前缀 + 档位命名,可直接粘进设计系统

    

Formula & Standard References

Item Formula / Note Source / Standard
Lightness shift hold hue and saturation, step lightness to build tints and shades CSS Color Module Level 4
Linear blending C = C1 x (1 - t) + C2 x t with t as the mix ratio CSS Color Module Level 4 color-mix()
Contrast retention shades must still meet the 4.5:1 readability requirement WCAG 2.2 (1.4.3)
⚠️ 使用说明与注意事项

📋 说明

左→右为由浅(tint)到基色再到深(shade)的渐变;每侧档数即混入白/黑的比例步数。

设计系统(如 Tailwind 的 50–900)常用这种按明度分档的色板组织方式。