First Commit

This commit is contained in:
2024-07-15 15:57:41 +03:00
commit 2f7b948cda
2137 changed files with 402438 additions and 0 deletions

6
node_modules/culori/src/dlch/constants.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export const kE = 1;
export const kCH = 1;
export const θ = (26 / 180) * Math.PI;
export const cosθ = Math.cos(θ);
export const sinθ = Math.sin(θ);
export const factor = 100 / Math.log(139 / 100); // ~ 303.67

28
node_modules/culori/src/dlch/convertDlchToLab65.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { kCH, kE, sinθ, cosθ, θ, factor } from './constants.js';
/*
Convert DIN99o LCh to CIELab D65
--------------------------------
*/
const convertDlchToLab65 = ({ l, c, h, alpha }) => {
let res = {
mode: 'lab65',
l: (Math.exp((l * kE) / factor) - 1) / 0.0039
};
if (h === undefined) {
res.a = res.b = 0;
} else {
let G = (Math.exp(0.0435 * c * kCH * kE) - 1) / 0.075;
let e = G * Math.cos((h / 180) * Math.PI - θ);
let f = G * Math.sin((h / 180) * Math.PI - θ);
res.a = e * cosθ - (f / 0.83) * sinθ;
res.b = e * sinθ + (f / 0.83) * cosθ;
}
if (alpha !== undefined) res.alpha = alpha;
return res;
};
export default convertDlchToLab65;

27
node_modules/culori/src/dlch/convertLab65ToDlch.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import { kCH, kE, sinθ, cosθ, θ, factor } from './constants.js';
import normalizeHue from '../util/normalizeHue.js';
/*
Convert CIELab D65 to DIN99o LCh
================================
*/
const convertLab65ToDlch = ({ l, a, b, alpha }) => {
let e = a * cosθ + b * sinθ;
let f = 0.83 * (b * cosθ - a * sinθ);
let G = Math.sqrt(e * e + f * f);
let res = {
mode: 'dlch',
l: (factor / kE) * Math.log(1 + 0.0039 * l),
c: Math.log(1 + 0.075 * G) / (0.0435 * kCH * kE)
};
if (res.c) {
res.h = normalizeHue(((Math.atan2(f, e) + θ) / Math.PI) * 180);
}
if (alpha !== undefined) res.alpha = alpha;
return res;
};
export default convertLab65ToDlch;

62
node_modules/culori/src/dlch/definition.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import convertLabToLch from '../lch/convertLabToLch.js';
import convertLchToLab from '../lch/convertLchToLab.js';
import convertDlchToLab65 from './convertDlchToLab65.js';
import convertLab65ToDlch from './convertLab65ToDlch.js';
import convertLab65ToRgb from '../lab65/convertLab65ToRgb.js';
import convertRgbToLab65 from '../lab65/convertRgbToLab65.js';
import { fixupHueShorter } from '../fixup/hue.js';
import { fixupAlpha } from '../fixup/alpha.js';
import { interpolatorLinear } from '../interpolate/linear.js';
import { differenceHueChroma } from '../difference.js';
import { averageAngle } from '../average.js';
const definition = {
mode: 'dlch',
parse: ['--din99o-lch'],
serialize: '--din99o-lch',
toMode: {
lab65: convertDlchToLab65,
dlab: c => convertLchToLab(c, 'dlab'),
rgb: c => convertLab65ToRgb(convertDlchToLab65(c))
},
fromMode: {
lab65: convertLab65ToDlch,
dlab: c => convertLabToLch(c, 'dlch'),
rgb: c => convertLab65ToDlch(convertRgbToLab65(c))
},
channels: ['l', 'c', 'h', 'alpha'],
ranges: {
l: [0, 100],
c: [0, 51.484],
h: [0, 360]
},
interpolate: {
l: interpolatorLinear,
c: interpolatorLinear,
h: {
use: interpolatorLinear,
fixup: fixupHueShorter
},
alpha: {
use: interpolatorLinear,
fixup: fixupAlpha
}
},
difference: {
h: differenceHueChroma
},
average: {
h: averageAngle
}
};
export default definition;