Create custom ramps for DittoTones
mainYou can use your own design system by providing a Map<string, Ramp>.
Constraints:
- Consistent Keys: All ramps in the Map must share the exact same shade keys. The constructor will throw if they differ.
- Neutral Ramp: Include at least one neutral (gray) ramp. If the input color has very low chroma, dittoTones will match it against the least chromatic ramp available.
import { DittoTones } from 'dittotones';
import { parse, oklch, type Oklch } from 'culori';
const customRamps = new Map([
[
'brand',
{
'50': oklch(parse('oklch(98% 0.01 250)')) as Oklch,
'500': oklch(parse('#3B82F6')) as Oklch,
'950': oklch(parse('oklch(25% 0.05 250)')) as Oklch,
},
],
]);
const ditto = new DittoTones({ ramps: customRamps });