-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from oddbird/color-issues
Add color issues section
- Loading branch information
Showing
10 changed files
with
167 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
import ExternalLink from '$lib/components/util/ExternalLink.svelte'; | ||
export let pass: boolean; | ||
let startOpen = 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> | ||
<p> | ||
Browsers implemented gamut mapping using clipping, which is fast but | ||
provides inferior results compared to the algorithm defined in the <ExternalLink | ||
href="https://drafts.csswg.org/css-color/#binsearch" | ||
>CSS Spec</ExternalLink | ||
>. 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> | ||
<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 | ||
colors, consider that most users will see these colors on a display that | ||
supports the <code>sRGB</code> or <code>P3</code> gamut. | ||
</p> | ||
<p>There are two primary ways a color can be out of gamut:</p> | ||
<ol> | ||
<li> | ||
Choosing a color in a space with a wider gamut, especially when a | ||
channel is near one of the edges of its range. | ||
</li> | ||
<li> | ||
Specifying a channel value that is outside its range. While the | ||
sliders in this tool set hard boundaries, values outside these | ||
boundaries are still valid, and can be entered in the text input. | ||
</li> | ||
</ol> | ||
<p> | ||
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> | ||
|
||
<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); | ||
} | ||
} | ||
summary { | ||
align-items: center; | ||
display: grid; | ||
gap: var(--shim-plus); | ||
grid-template-columns: max-content var(--triangle-height); | ||
} | ||
.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; | ||
} | ||
p { | ||
margin-block-end: var(--gutter); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// The Details disclosure element | ||
// ------------------------------ | ||
|
||
details { | ||
--link: var(--fgcolor); | ||
--link-focus: var(--fgcolor); | ||
|
||
background-color: var(--status-result-bg, var(--bgcolor)); | ||
border-radius: var(--border-radius); | ||
color: var(--status-result-fg, var(--fgcolor)); | ||
} | ||
|
||
summary { | ||
cursor: pointer; | ||
font-weight: bold; | ||
|
||
// Hides marker some browsers add | ||
&::marker { | ||
content: none; | ||
} | ||
|
||
// Hides marker webkit adds | ||
&::-webkit-details-marker { | ||
display: none; | ||
} | ||
|
||
&::before { | ||
border-color: transparent transparent transparent currentcolor; | ||
border-style: solid; | ||
border-width: var(--triangle-width) 0 var(--triangle-width) | ||
var(--triangle-height); | ||
content: ''; | ||
grid-column: 2; | ||
grid-row: 1; | ||
margin-block-start: var(--half-shim); | ||
rotate: var(--rotate-triangle, none); | ||
transition: rotate var(--fast); | ||
|
||
[open] & { | ||
--rotate-triangle: 90deg; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
@forward 'buttons'; | ||
@forward 'icons'; | ||
@forward 'lists'; | ||
@forward 'disclosure'; | ||
@forward 'themes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters