mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
refactor: use named ColorBlindnessOptions interface in operation signature
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import type { ColorBlindnessType, Sharp } from "../types.js";
|
import type { ColorBlindnessOptions, ColorBlindnessType, Sharp } from "../types.js";
|
||||||
|
|
||||||
type Matrix3x3 = [[number, number, number], [number, number, number], [number, number, number]];
|
type Matrix3x3 = [[number, number, number], [number, number, number], [number, number, number]];
|
||||||
|
|
||||||
@@ -45,9 +45,6 @@ export const COLOR_BLINDNESS_MATRICES: Record<ColorBlindnessType, Matrix3x3> = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function colorBlindness(
|
export async function colorBlindness(image: Sharp, options: ColorBlindnessOptions): Promise<Sharp> {
|
||||||
image: Sharp,
|
|
||||||
options: { type: ColorBlindnessType },
|
|
||||||
): Promise<Sharp> {
|
|
||||||
return image.recomb(COLOR_BLINDNESS_MATRICES[options.type]);
|
return image.recomb(COLOR_BLINDNESS_MATRICES[options.type]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user