Skip to content

Commit

Permalink
add xyz65 to color convert
Browse files Browse the repository at this point in the history
  • Loading branch information
mck committed Jun 11, 2024
1 parent 9cf20bb commit ffaa838
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions packages/graph-engine/src/nodes/color/convert.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { INodeDefinition, ToInput, ToOutput } from "../../index.js";
import { Color, NodeTypes } from "../../types.js";
import { Node } from "../../programmatic/node.js";
import { Rgb, Lab, Hsl, converter } from "culori";
import {
ColorSchema,
NumberSchema,
StringSchema,
} from "../../schemas/index.js";
import { Hsl, Lab, Rgb, Xyz65, converter } from "culori";
import { INodeDefinition, ToInput, ToOutput } from "../../index.js";
import { Node } from "../../programmatic/node.js";
import { arrayOf } from "../../schemas/utils.js";

export const colorSpaces = [
Expand All @@ -23,10 +23,12 @@ export const colorSpaces = [
"rec2020",

//LAB like

"dlab",
"lab65",

//XYZ
"xyz65",

//HSL like
"okhsl",
"cubehelix",
Expand Down Expand Up @@ -172,6 +174,19 @@ export default class NodeDefinition extends Node {
};
}
break;
case "xyz65":
{
const col: Xyz65 = output as unknown as Xyz65;
final = {
a: col.x,
b: col.y,
c: col.z,
d: col.alpha,
channels: [col.x, col.y, col.z, col.alpha],
labels: ["x", "y", "z", "alpha"],
};
}
break;
default:
throw new Error("Invalid color space");
}
Expand Down

0 comments on commit ffaa838

Please sign in to comment.