Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/oddbird/oddcontrast into sw…
Browse files Browse the repository at this point in the history
…ap-colors
  • Loading branch information
jamesnw committed Feb 4, 2025
2 parents 88a1575 + 6d1e4e0 commit e505247
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 95 deletions.
69 changes: 20 additions & 49 deletions src/lib/components/ratio/ColorIssues.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<script lang="ts">
import { onMount } from 'svelte';
import ExternalLink from '$lib/components/util/ExternalLink.svelte';
interface Props {
pass: boolean;
}
let { pass }: Props = $props();
let startOpen = $state(false);
onMount(() => {
startOpen = window.matchMedia('(min-width: 80em)').matches;
});
</script>

<details class="known-issues" open={startOpen} data-pass={pass}>
<summary>Known Color Issues</summary>
<dl class="issues-list">
<dt>Gamut Mapping Implementation</dt>
<dd>
<hr />
<div class="known-issues">
<h2 class="section-heading">Known Color Issues</h2>
<ul class="issues-list">
<li>
<h3 class="list-item-heading">Gamut Mapping Implementation</h3>
<p>
Browsers implemented gamut mapping using clipping, which is fast but
provides inferior results compared to the algorithm defined in the <ExternalLink
Expand All @@ -28,9 +16,9 @@
>. Until browsers are updated, colors that are out of gamut for your
screen may be displayed very differently than expected.
</p>
</dd>
<dt>Checking for Out of Gamut Colors</dt>
<dd>
</li>
<li>
<h3 class="list-item-heading">Checking for Out of Gamut Colors</h3>
<p>
The new color features in CSS allow for a much wider range of colors,
many of which cannot be shown on many (or any) screens. When selecting
Expand All @@ -53,42 +41,25 @@
When a color is out of gamut for the user's screen, the browser will
adjust the color to be in gamut.
</p>
</dd>
</dl>
</details>
</li>
</ul>
</div>

<style lang="scss">
@use 'config';
.known-issues {
grid-area: knownissues;
padding: var(--gutter);
@include config.above('lg-page-break') {
margin-inline: calc(var(--gutter) * -1);
}
hr {
border: unset;
border-block-start: var(--border-width) solid var(--border-light);
margin-block-end: var(--spacer);
margin-inline: var(--double-gutter);
}
summary {
align-items: center;
display: grid;
gap: var(--shim-plus);
grid-template-columns: max-content var(--triangle-height);
.known-issues {
margin-block-end: var(--spacer);
}
.issues-list {
display: grid;
gap: var(--half-shim);
grid-auto-rows: auto;
grid-template-columns: 1fr;
margin-block-start: var(--gutter);
}
dt {
font-weight: bold;
}
dd {
--description-margin-inline: 0;
max-inline-size: 85ch;
}
p {
Expand Down
2 changes: 0 additions & 2 deletions src/lib/components/ratio/index.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { contrast } from 'colorjs.io/fn';
import ColorIssues from '$lib/components/ratio/ColorIssues.svelte';
import Result from '$lib/components/ratio/Result.svelte';
import ExternalLink from '$lib/components/util/ExternalLink.svelte';
import { RATIOS } from '$lib/constants';
Expand Down Expand Up @@ -66,7 +65,6 @@
<dd>Bold Weight</dd>
</dl>
</div>
<ColorIssues {pass} />
</aside>

<style lang="scss">
Expand Down
2 changes: 2 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import Header from '$lib/components/Header.svelte';
import Ratio from '$lib/components/ratio/index.svelte';
import { bg, fg, format } from '$lib/stores';
import ColorIssues from '$src/lib/components/ratio/ColorIssues.svelte';
import { hashToStoreValues, storeValuesToHash } from '$src/lib/utils';
let bg_fallback = $derived(display($bg));
Expand Down Expand Up @@ -49,6 +50,7 @@
<Ratio />
<main data-layout="main">
<Colors />
<ColorIssues />
</main>
<Footer />
</div>
43 changes: 0 additions & 43 deletions src/sass/patterns/_disclosure.scss

This file was deleted.

1 change: 0 additions & 1 deletion src/sass/patterns/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
@forward 'buttons';
@forward 'icons';
@forward 'lists';
@forward 'disclosure';
@forward 'themes';
5 changes: 5 additions & 0 deletions src/sass/patterns/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ dl {
dd {
margin-inline-start: var(--description-margin-inline, var(--gutter));
}

.list-item-heading {
font-size: var(--small);
font-weight: bold;
}

0 comments on commit e505247

Please sign in to comment.