Skip to content

Commit

Permalink
Default to P3
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Nov 29, 2023
1 parent c046929 commit 0277cdf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/colors/ImplementationWarning.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script lang="ts">
import ExternalLink from '$lib/components/util/ExternalLink.svelte';
import type { ColorFormatId } from '$lib/constants';
export let format: ColorFormatId;
import Icon from '$lib/components/util/Icon.svelte';
import type { ColorFormatId } from '$lib/constants';
import { ColorSpace } from '$lib/stores';
import { getSpaceFromFormatId } from '$lib/utils';
export let format: ColorFormatId;
$: targetSpace = getSpaceFromFormatId(format);
$: spaceObject = ColorSpace.get(targetSpace);
// TODO: Can be replaced with spaceObject.isUnbounded in next version of

Check warning on line 12 in src/lib/components/colors/ImplementationWarning.svelte

View workflow job for this annotation

GitHub Actions / Lint

Unexpected 'todo' comment: 'TODO: Can be replaced with...'
Expand Down
6 changes: 3 additions & 3 deletions src/lib/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ ColorSpace.register(REC_2020);
export { ColorSpace };

export const INITIAL_VALUES = {
format: 'oklch' as ColorFormatId,
bg_coord: [0.3259, 0.1333, 265.49] as [number, number, number],
fg_coord: [0.8241, 0.1061, 0.8587] as [number, number, number],
format: 'p3' as ColorFormatId,
bg_coord: [0.0967, 0.167, 0.4494] as [number, number, number],
fg_coord: [0.951, 0.675, 0.7569] as [number, number, number],
alpha: 1,
};

Expand Down
6 changes: 3 additions & 3 deletions test/js/lib/components/SpaceSelect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fireEvent, render } from '@testing-library/svelte';
import { get } from 'svelte/store';

import Space from '$lib/components/SpaceSelect.svelte';
import { bg, fg, reset } from '$lib/stores';
import { bg, fg, INITIAL_VALUES, reset } from '$lib/stores';

describe('Space', () => {
afterEach(() => {
Expand All @@ -12,8 +12,8 @@ describe('Space', () => {
it('renders editable space select', async () => {
const { getByLabelText } = render(Space);

expect(get(bg).space.id).toBe('oklch');
expect(get(fg).space.id).toBe('oklch');
expect(get(bg).space.id).toBe(INITIAL_VALUES.format);
expect(get(fg).space.id).toBe(INITIAL_VALUES.format);

const select = getByLabelText('Color Format');
await fireEvent.change(select, { target: { value: 'hsl' } });
Expand Down

0 comments on commit 0277cdf

Please sign in to comment.