let known quox colour schemes specify any colours
This commit is contained in:
parent
355ea44003
commit
da410a74f2
1 changed files with 70 additions and 70 deletions
|
@ -37,20 +37,18 @@ export function makeColorInfo<A>(f: (l: Layer) => A): Record<Layer, A> {
|
||||||
return Object.fromEntries(allLayers.map(l => [l, f(l)])) as Record<Layer, A>;
|
return Object.fromEntries(allLayers.map(l => [l, f(l)])) as Record<Layer, A>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BaseCol = 'outer' | 'belly' | 'fins';
|
type KnownPalette = Partial<Record<Layer, Color>>;
|
||||||
export type OptionalBaseCol = 'eyes' | 'stripes';
|
|
||||||
|
|
||||||
type KnownPalette =
|
|
||||||
Record<BaseCol, Color> & Partial<Record<OptionalBaseCol, Color>>;
|
|
||||||
|
|
||||||
|
|
||||||
export function colors(r: Rand = new Rand(), base?: KnownPalette): Scheme {
|
export function colors(r: Rand = new Rand(), base?: KnownPalette): Scheme {
|
||||||
const outer = base?.outer ?? r.color('dark');
|
const outer = base?.outer ?? r.color('dark');
|
||||||
const outerCols: OuterCols =
|
const spines = base?.spines ?? mkSpines(r, outer);
|
||||||
{ outer, spines: mkSpines(r, outer), vitiligo1: mkVitiligo(r, outer) };
|
const vitiligo1 = base?.vitiligo1 ?? mkVitiligo(r, outer);
|
||||||
|
const outerCols: OuterCols = { outer, spines, vitiligo1 };
|
||||||
|
|
||||||
const stripes = mkStripes(r);
|
const stripes = base?.stripes ?? mkStripes(r);
|
||||||
const sockCols: SockCols = { stripes, cuffs: mkCuffs(r, stripes) };
|
const cuffs = base?.cuffs ?? mkCuffs(r, stripes);
|
||||||
|
const sockCols: SockCols = { stripes, cuffs };
|
||||||
|
|
||||||
let finCols: FinCols, bellyCols: BellyCols, type: SchemeType;
|
let finCols: FinCols, bellyCols: BellyCols, type: SchemeType;
|
||||||
const whichBody = r.float();
|
const whichBody = r.float();
|
||||||
|
@ -105,7 +103,7 @@ function mkCuffs(r: Rand, sock: Color): Color {
|
||||||
|
|
||||||
function mkFins(r: Rand, h: Hue, outer: Color,
|
function mkFins(r: Rand, h: Hue, outer: Color,
|
||||||
base?: KnownPalette): FinCols {
|
base?: KnownPalette): FinCols {
|
||||||
const baseFin1 = base?.fins;
|
const baseFin1 = base?.fins1;
|
||||||
const [fin1Hue, fin2Hue, fin3Hue] = r.analogous(baseFin1?.hue ?? h, 3);
|
const [fin1Hue, fin2Hue, fin3Hue] = r.analogous(baseFin1?.hue ?? h, 3);
|
||||||
|
|
||||||
const direction: 'lighter' | 'darker' = r.choice(['lighter', 'darker']);
|
const direction: 'lighter' | 'darker' = r.choice(['lighter', 'darker']);
|
||||||
|
@ -119,32 +117,35 @@ function mkFins(r: Rand, h: Hue, outer: Color,
|
||||||
|
|
||||||
const fins1 = baseFin1 ??
|
const fins1 = baseFin1 ??
|
||||||
oklch(ll(outer.luma), cc(outer.luma, outer.chroma), fin1Hue!);
|
oklch(ll(outer.luma), cc(outer.luma, outer.chroma), fin1Hue!);
|
||||||
const fins2 = oklch(ll(fins1.luma), cc(fins1.luma, fins1.chroma), fin2Hue!);
|
const fins2 = base?.fins2 ??
|
||||||
const fins3 = oklch(ll(fins2.luma), cc(fins2.luma, fins2.chroma), fin3Hue!);
|
oklch(ll(fins1.luma), cc(fins1.luma, fins1.chroma), fin2Hue!);
|
||||||
|
const fins3 = base?.fins3 ??
|
||||||
|
oklch(ll(fins2.luma), cc(fins2.luma, fins2.chroma), fin3Hue!);
|
||||||
const lighter = fins1.luma >= fins3.luma ? fins1 : fins3;
|
const lighter = fins1.luma >= fins3.luma ? fins1 : fins3;
|
||||||
const vitiligo4 = mkVitiligo(r, lighter);
|
const vitiligo4 = base?.vitiligo4 ?? mkVitiligo(r, lighter);
|
||||||
return { fins1, fins2, fins3, vitiligo4 };
|
return { fins1, fins2, fins3, vitiligo4 };
|
||||||
}
|
}
|
||||||
|
|
||||||
function mkBelly(r: Rand, h: Hue, base?: KnownPalette): BellyCols {
|
function mkBelly(r: Rand, h: Hue, base?: KnownPalette): BellyCols {
|
||||||
const baseBelly1 = base?.belly;
|
const baseBelly1 = base?.belly1;
|
||||||
const [belly1Hue, belly2Hue] = r.analogous(baseBelly1?.hue ?? h, 2);
|
const [belly1Hue, belly2Hue] = r.analogous(baseBelly1?.hue ?? h, 2);
|
||||||
const belly1 = baseBelly1 ??
|
const belly1 = baseBelly1 ??
|
||||||
oklch(r.float(0.7, r.maxl), r.baseChroma(1), belly1Hue!);
|
oklch(r.float(0.7, r.maxl), r.baseChroma(1), belly1Hue!);
|
||||||
const belly2 = belly1.with({ type: 'oklch',
|
const belly2 = base?.belly2 ?? belly1.with({ type: 'oklch',
|
||||||
l: x => min(r.maxl, x * 1.1),
|
l: x => min(r.maxl, x * 1.1),
|
||||||
c: x => x * 0.9,
|
c: x => x * 0.9,
|
||||||
h: [belly2Hue!],
|
h: [belly2Hue!],
|
||||||
});
|
});
|
||||||
const vitiligo3 = mkVitiligo(r, belly1);
|
const vitiligo3 = base?.vitiligo3 ?? mkVitiligo(r, belly1);
|
||||||
const vitiligo2 = mkVitiligo(r, belly2);
|
const vitiligo2 = base?.vitiligo2 ?? mkVitiligo(r, belly2);
|
||||||
return { belly1, belly2, vitiligo2, vitiligo3 };
|
return { belly1, belly2, vitiligo2, vitiligo3 };
|
||||||
}
|
}
|
||||||
|
|
||||||
function mkMisc(r: Rand, o: OuterCols, f: FinCols, b: BellyCols,
|
function mkMisc(r: Rand, o: OuterCols, f: FinCols, b: BellyCols,
|
||||||
base?: KnownPalette): MiscCols {
|
base?: KnownPalette): MiscCols {
|
||||||
const masks = oklch(r.float(0.8, r.maxl), r.float(0.01, 0.06),
|
const masks = base?.masks ??
|
||||||
r.analogous1(r.choice([o.outer, b.belly1, f.fins1]).hue));
|
oklch(r.float(0.8, r.maxl), r.float(0.01, 0.06),
|
||||||
|
r.analogous1(r.choice([o.outer, b.belly1, f.fins1]).hue));
|
||||||
return {
|
return {
|
||||||
masks,
|
masks,
|
||||||
eyes: base?.eyes ?? oklch(
|
eyes: base?.eyes ?? oklch(
|
||||||
|
@ -152,13 +153,14 @@ function mkMisc(r: Rand, o: OuterCols, f: FinCols, b: BellyCols,
|
||||||
r.float(0.28, r.maxcLight),
|
r.float(0.28, r.maxcLight),
|
||||||
r.boolean() ? r.analogous1(o.outer.hue) : r.complementary1(o.outer.hue)
|
r.boolean() ? r.analogous1(o.outer.hue) : r.complementary1(o.outer.hue)
|
||||||
),
|
),
|
||||||
claws: masks.with({ type: 'oklch',
|
claws: base?.claws ??
|
||||||
l: x => min(r.maxl, x + r.float(0, 0.1)),
|
masks.with({ type: 'oklch',
|
||||||
c: [r.float(0.01, 0.06)],
|
l: x => min(r.maxl, x + r.float(0, 0.1)),
|
||||||
h: h => r.analogous1(h),
|
c: [r.float(0.01, 0.06)],
|
||||||
}),
|
h: h => r.analogous1(h),
|
||||||
lines: oklch(r.float(0.01, 0.06), r.baseChroma(0),
|
}),
|
||||||
r.analogous1(o.outer.hue)),
|
lines: base?.lines ??
|
||||||
|
oklch(r.float(0.01, 0.06), r.baseChroma(0), r.analogous1(o.outer.hue)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,69 +179,67 @@ function merge({ outer, spines, vitiligo1 }: OuterCols,
|
||||||
|
|
||||||
export const KNOWN: Record<string, KnownPalette> = {
|
export const KNOWN: Record<string, KnownPalette> = {
|
||||||
niss: {
|
niss: {
|
||||||
outer: oklch(0.83, 0.201, 151),
|
outer: oklch(0.83, 0.201, 151),
|
||||||
belly: oklch(0.87, 0.082, 99),
|
belly1: oklch(0.87, 0.082, 99),
|
||||||
fins: oklch(0.68, 0.178, 16),
|
fins1: oklch(0.68, 0.178, 16),
|
||||||
eyes: oklch(0.73, 0.135, 242),
|
eyes: oklch(0.73, 0.135, 242),
|
||||||
},
|
},
|
||||||
kesi: {
|
kesi: {
|
||||||
outer: oklch(0.86, 0.147, 147),
|
outer: oklch(0.86, 0.147, 147),
|
||||||
belly: oklch(0.96, 0.04, 108),
|
belly1: oklch(0.96, 0.04, 108),
|
||||||
fins: oklch(0.94, 0.142, 102),
|
fins1: oklch(0.94, 0.142, 102),
|
||||||
eyes: oklch(0.76, 0.115, 300),
|
eyes: oklch(0.76, 0.115, 300),
|
||||||
},
|
},
|
||||||
60309: {
|
60309: {
|
||||||
outer: oklch(0.84, 0.068, 212),
|
outer: oklch(0.84, 0.068, 212),
|
||||||
belly: oklch(0.56, 0.035, 233),
|
belly1: oklch(0.56, 0.035, 233),
|
||||||
fins: oklch(0.55, 0.101, 268),
|
fins1: oklch(0.55, 0.101, 268),
|
||||||
eyes: oklch(0.86, 0.146, 154),
|
eyes: oklch(0.86, 0.146, 154),
|
||||||
},
|
},
|
||||||
'prickly pear': {
|
'prickly pear': {
|
||||||
outer: oklch(0.64, 0.087, 316),
|
outer: oklch(0.64, 0.087, 316),
|
||||||
belly: oklch(0.88, 0.03, 88),
|
belly1: oklch(0.88, 0.03, 88),
|
||||||
fins: oklch(0.6, 0.071, 142),
|
fins1: oklch(0.6, 0.071, 142),
|
||||||
eyes: oklch(0.66, 0.091, 134),
|
eyes: oklch(0.66, 0.091, 134),
|
||||||
},
|
},
|
||||||
'the goo': {
|
'the goo': {
|
||||||
outer: oklch(0.92, 0.046, 354),
|
outer: oklch(0.92, 0.046, 354),
|
||||||
belly: oklch(0.83, 0.099, 354),
|
belly1: oklch(0.83, 0.099, 354),
|
||||||
fins: oklch(0.74, 0.115, 354),
|
fins1: oklch(0.74, 0.115, 354),
|
||||||
eyes: oklch(0.73, 0.149, 0),
|
eyes: oklch(0.73, 0.149, 0),
|
||||||
},
|
},
|
||||||
lambda: {
|
lambda: {
|
||||||
outer: oklch(0.71, 0.154, 58),
|
outer: oklch(0.71, 0.154, 58),
|
||||||
belly: oklch(0.9, 0.05, 80),
|
belly1: oklch(0.9, 0.05, 80),
|
||||||
fins: oklch(0.76, 0.16, 140),
|
fins1: oklch(0.76, 0.16, 140),
|
||||||
eyes: oklch(0.82, 0.178, 141),
|
eyes: oklch(0.82, 0.178, 141),
|
||||||
},
|
},
|
||||||
flussence: {
|
flussence: {
|
||||||
outer: oklch(0.77, 0.118, 133),
|
outer: oklch(0.77, 0.118, 133),
|
||||||
belly: oklch(0.71, 0.086, 253),
|
belly1: oklch(0.71, 0.086, 253),
|
||||||
fins: oklch(0.58, 0.102, 254),
|
fins1: oklch(0.58, 0.102, 254),
|
||||||
eyes: oklch(0.37, 0.107, 278),
|
eyes: oklch(0.37, 0.107, 278),
|
||||||
},
|
},
|
||||||
serena: {
|
serena: {
|
||||||
outer: oklch(0.69, 0.176, 349),
|
outer: oklch(0.69, 0.176, 349),
|
||||||
belly: oklch(0.92, 0.04, 350),
|
belly1: oklch(0.92, 0.04, 350),
|
||||||
fins: oklch(0.74, 0.138, 319),
|
fins1: oklch(0.74, 0.138, 319),
|
||||||
eyes: oklch(0.65, 0.206, 4),
|
eyes: oklch(0.65, 0.206, 4),
|
||||||
},
|
},
|
||||||
pippin: {
|
pippin: {
|
||||||
outer: oklch(0.74, 0.08, 61),
|
outer: oklch(0.74, 0.08, 61),
|
||||||
belly: oklch(0.82, 0.062, 70),
|
belly1: oklch(0.82, 0.062, 70),
|
||||||
fins: oklch(0.52, 0.09, 45),
|
fins1: oklch(0.52, 0.09, 45),
|
||||||
eyes: oklch(0.74, 0.167, 136),
|
eyes: oklch(0.74, 0.167, 136),
|
||||||
},
|
},
|
||||||
su: {
|
su: {
|
||||||
outer: oklch(0.29, 0.012, 219),
|
outer: oklch(0.29, 0.012, 219),
|
||||||
belly: oklch(0.89, 0.01, 256),
|
belly1: oklch(0.89, 0.01, 256),
|
||||||
fins: oklch(0.53, 0.093, 20),
|
fins1: oklch(0.53, 0.093, 20),
|
||||||
// eyes: oklch(0.53, 0.109, 254),
|
|
||||||
},
|
},
|
||||||
trans: {
|
trans: {
|
||||||
outer: oklch(0.83, 0.065, 228),
|
outer: oklch(0.83, 0.065, 228),
|
||||||
belly: oklch(0.95, 0.021, 137),
|
belly1: oklch(0.95, 0.021, 137),
|
||||||
fins: oklch(0.86, 0.069, 352),
|
fins1: oklch(0.86, 0.069, 352),
|
||||||
// eyes: oklch(0.57, 0.158, 273),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue