Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Sep 25, 2021
1 parent 1d74286 commit 6a8cd62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/p4/ColorPicker.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import ColorSlider from './ColorSlider.svelte';
import {hexToRGb, rgbToHex, rgbToHsv, hsvToRgb} from './color-utils';
import {hexToRgb, rgbToHex, rgbToHsv, hsvToRgb} from './color-utils';
import {_} from '../locales';
export let value;
Expand All @@ -26,7 +26,7 @@
valueAsHsv = hsv;
};
const setHex = (hex) => {
const valueAsRgb = hexToRGb(hex);
const valueAsRgb = hexToRgb(hex);
value = hex;
valueAsHsv = rgbToHsv(...valueAsRgb);
};
Expand Down
2 changes: 1 addition & 1 deletion src/p4/color-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// - The H, S, V channels of HSV[A] are in [0-1]
// - The A channel is always in [0-1]

export const hexToRGb = (hex) => {
export const hexToRgb = (hex) => {
hex = hex.trim();
if (hex.startsWith('#')) {
hex = hex.substr(1);
Expand Down
18 changes: 9 additions & 9 deletions test/p4/color-utils.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {hexToRGb, rgbToHex, rgbToHsv, hsvToRgb} from '../../src/p4/color-utils';
import {hexToRgb, rgbToHex, rgbToHsv, hsvToRgb} from '../../src/p4/color-utils';

test('hexToRGb', () => {
expect(hexToRGb('#000000')).toEqual([0, 0, 0]);
expect(hexToRGb('#fffFFf')).toEqual([255, 255, 255]);
expect(hexToRGb('#abcdef')).toEqual([0xab, 0xcd, 0xef]);
expect(hexToRGb('abcdef')).toEqual([0xab, 0xcd, 0xef]);
expect(hexToRGb(' abcdef ')).toEqual([0xab, 0xcd, 0xef]);
expect(hexToRGb('#fff')).toEqual([255, 255, 255]);
expect(hexToRGb('abc')).toEqual([0xaa, 0xbb, 0xcc]);
test('hexToRgb', () => {
expect(hexToRgb('#000000')).toEqual([0, 0, 0]);
expect(hexToRgb('#fffFFf')).toEqual([255, 255, 255]);
expect(hexToRgb('#abcdef')).toEqual([0xab, 0xcd, 0xef]);
expect(hexToRgb('abcdef')).toEqual([0xab, 0xcd, 0xef]);
expect(hexToRgb(' abcdef ')).toEqual([0xab, 0xcd, 0xef]);
expect(hexToRgb('#fff')).toEqual([255, 255, 255]);
expect(hexToRgb('abc')).toEqual([0xaa, 0xbb, 0xcc]);
});

test('rgbToHex', () => {
Expand Down

0 comments on commit 6a8cd62

Please sign in to comment.