Import/export chat styles

This commit is contained in:
Fedor Indutny 2024-07-15 13:58:55 -07:00 committed by GitHub
parent 6fb76e00c4
commit 8f2061e11d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 663 additions and 47 deletions

View file

@ -0,0 +1,42 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { rgbToHSL } from '../../util/rgbToHSL';
describe('rgbToHSL', () => {
it('converts pure rgb colors', () => {
assert.deepStrictEqual(rgbToHSL(255, 0, 0), {
h: 0,
s: 1,
l: 0.5,
});
assert.deepStrictEqual(rgbToHSL(0, 255, 0), {
h: 120,
s: 1,
l: 0.5,
});
assert.deepStrictEqual(rgbToHSL(0, 0, 255), {
h: 240,
s: 1,
l: 0.5,
});
});
it('converts random sampled rgb colors', () => {
assert.deepStrictEqual(rgbToHSL(27, 132, 116), {
h: 170.85714285714283,
s: 0.6603773584905662,
l: 0.31176470588235294,
});
assert.deepStrictEqual(rgbToHSL(27, 175, 82), {
h: 142.2972972972973,
s: 0.7326732673267328,
l: 0.396078431372549,
});
});
});