Skip to content

Commit

Permalink
feat(color): add .toString() impl
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Feb 23, 2021
1 parent e993e04 commit cc65bf0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/color/src/defcolor.ts
Expand Up @@ -8,6 +8,7 @@ import {
import { illegalArgs } from "@thi.ng/errors";
import { EPS } from "@thi.ng/math";
import type { IRandom } from "@thi.ng/random";
import { vector } from "@thi.ng/strings";
import {
clamp4,
declareIndices,
Expand Down Expand Up @@ -124,12 +125,16 @@ export const defColor = <M extends ColorMode, K extends string>(
return eqDelta4(this, <any>o, eps);
}

randomize(rnd?: IRandom): this {
return <any>randMinMax(this, minR, maxR, rnd);
}

toJSON() {
return this.deref();
}

randomize(rnd?: IRandom): this {
return <any>randMinMax(this, minR, maxR, rnd);
toString() {
return vector(4, 4)(this);
}
};

Expand Down

0 comments on commit cc65bf0

Please sign in to comment.