palette
This commit is contained in:
parent
d0099fbf19
commit
815ef5c23f
10 changed files with 256 additions and 131 deletions
|
@ -108,7 +108,11 @@ export class Oklch {
|
|||
}
|
||||
|
||||
css(alpha: number = 1): string {
|
||||
return `oklch(${this.l} ${this.c} ${this.h} / ${alpha})`;
|
||||
const l = (this.l * 100).toFixed(0);
|
||||
const c = (this.c * 250).toFixed(0);
|
||||
const h = this.h.toFixed(0);
|
||||
if (alpha != 1) { return `oklch(${l}% ${c}% ${h} / ${alpha})`; }
|
||||
else { return `oklch(${l}% ${c}% ${h})`; }
|
||||
}
|
||||
|
||||
with(lch: Partial<Record<Oklch.Channel, number | Oklch.ChannelMap>>): Oklch {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue