Skip to content

Commit

Permalink
Fixes lab65 <-> lch65 direct conversion (the modes were wrong)
Browse files Browse the repository at this point in the history
  • Loading branch information
danburzo committed Dec 24, 2020
1 parent 6c55c10 commit c3480fb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lch65/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default {
mode: 'lch65',
alias: ['lch-d65'],
output: {
lab65: convertLchToLab,
lab65: c => convertLchToLab(c, 'lab65'),
rgb: c => convertLab65ToRgb(convertLchToLab(c, 'lab65'))
},
input: {
rgb: c => convertLabToLch(convertRgbToLab65(c), 'lch65'),
lab65: convertLabToLch
lab65: c => convertLabToLch(c, 'lch65')
},
parsers: [],
ranges: {
Expand Down
24 changes: 23 additions & 1 deletion test/lch65.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tape from 'tape';
import { lch65 } from '../src/index';
import { lch65, lab65 } from '../src/index';

tape('lch65', t => {
t.deepEqual(
Expand All @@ -25,3 +25,25 @@ tape('lch65', t => {
);
t.end();
});

tape('lab65 <-> lch65', t => {
t.deepEqual(lch65(lab65({ l: 100, a: 0.2, b: 0.2 })), {
mode: 'lch65',
l: 100,
c: 0.28284271247461906,
h: 45
});

t.deepEqual(
lab65(
lch65({
mode: 'lch65',
l: 100,
c: 0.28284271247461906,
h: 45
})
),
{ mode: 'lab65', l: 100, a: 0.20000000000000004, b: 0.2 }
);
t.end();
});

0 comments on commit c3480fb

Please sign in to comment.