lifehash
Version:
TypeScript/JavaScript implementation of LifeHash, a visual hash algorithm
34 lines (33 loc) • 989 B
JavaScript
import { Color } from './Color.js';
import { blend, blend_many } from './color-utils.js';
export const Colors = {
black: new Color(0, 0, 0),
blue: new Color(0, 0, 1),
cyan: new Color(0, 1, 1),
green: new Color(0, 1, 0),
magenta: new Color(1, 0, 1),
red: new Color(1, 0, 0),
white: new Color(1, 1, 1),
yellow: new Color(1, 1, 0),
};
export const grayscale = blend(Colors.black, Colors.white);
const spectrum_colors = [
[],
[],
[],
[],
[],
[],
[],
];
export const spectrum = blend_many(spectrum_colors.map((vals) => Color.from_uint8_values(...vals)));
export const spectrum_cmyk_safe_colors = [
[],
[],
[],
[],
[],
[],
[],
];
export const spectrum_cmyk_safe = blend_many(spectrum_cmyk_safe_colors.map((vals) => Color.from_uint8_values(...vals)));