forked from siege-media/contrast-ratio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
109 lines (97 loc) · 4.79 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="Check the contrast ratio between your website’s background and text colors using this free tool, designed to meet WCAG guidelines">
<title>Contrast Ratio: WCAG Color Contrast Checker 🚀</title>
<link rel="canonical" href="https://contrast-ratio.org" />
<link rel="stylesheet" href="style.css" />
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>
<span class="wrapper">
<span class="inner"><span class="first">Contrast</span></span>
<span class="inner"><strong class="second">ratio</strong></span>
</span>
</h1>
<label class="background">
<span class="text">Background:</span>
<span class="input-wrapper">
<input id="background" class="text-input" value="white" autofocus />
<input id="backgroundColorPicker" class="color-picker" type="color" tabindex="-1" />
</span>
<output for="background foreground" class="rl" aria-live="polite" aria-label="Relative Luminance"></output>
</label>
<label class="foreground">
<span class="text">Text color:</span>
<span class="input-wrapper">
<input id="foreground" class="text-input" value="hsla(200,0%,0%,.7)" />
<input id="foregroundColorPicker" class="color-picker" type="color" tabindex="-1" />
</span>
<output for="background foreground" class="rl" aria-live="polite" aria-label="Relative Luminance"></output>
</label>
<output for="background foreground" class="contrast" tabindex="0" aria-live="polite">
<strong>?</strong>
<span class="error"></span>
</output>
<section id="results">
<output for="background foreground" id="preciseContrast" aria-label="Precise contrast"></output>
<output for="background foreground" id="wcag"></output>
</section>
<section class="color-display" id="backgroundDisplay">
<h2>How to use</h2>
<p>As you type, the contrast ratio indicated will update. Hover over the circle to get more detailed information.
When semi-transparent colors are involved as backgrounds, the contrast ratio will have an error margin, to account
for the different colors they may be over.</p>
<p style="font-family: Garamond, 'Palatino Linotype', Georgia, serif;">This sample text attempts to visually
demonstrate how readable this color combination is, for normal, <span style="font-style: italic;">italic</span>,
<span style="font-weight: bold;">bold</span>, or <span style="font-style: italic; font-weight: bold;">bold
italic</span> text of various sizes and font styles.
</p>
<p style="font-size: 11pt;"><strong>Hint:</strong> Press the up and down keyboard arrows while over a number inside
a functional color notation. Watch it increment/decrement. Try with the Shift or Alt key too!</p>
<footer>
By <a href="https://lea.verou.me" rel="noopener" target="_blank">Lea Verou</a>
• <a href="https://www.w3.org/TR/WCAG/#contrast-minimum" rel="noopener" target="_blank">WCAG 2.1 on contrast
ratio</a><br>
Reuploaded old version by <a href="https://moritzgiessmann.de">Moritz Gießmann</a><br>
<a href="https://ko-fi.com/J3J3JAWO1" target="_blank" class="kofi-link">
<img height="36" src="https://storage.ko-fi.com/cdn/kofi3.png?v=3" alt="Buy Me a Coffee at ko-fi.com">
</a>Support me hosting this
</footer>
</section>
<section class="color-display" id="foregroundDisplay">
<button id="swap">↔ Swap colors</button>
</section>
<footer></footer>
<!-- Original at: https://leaverou.github.io/incrementable/incrementable.js -->
<script src="leaverou-incrementable.js" id="incrementable" async></script>
<script src="color.js"></script>
<script src="contrast-ratio.js"></script>
<div class="social">
<a class="github-button" href="https://github.com/MoritzGiessmann/contrast-ratio" data-icon="octicon-star"
data-size="large" data-show-count="true" aria-label="Contrast-ratio on GitHub">Star</a>
</div>
<script async defer src="github-button.js"></script>
<!-- Matomo -->
<script>
let _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDoNotTrack", true]);
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
let u="https://m0g1.uber.space/piwik/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '15']);
let d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img referrerpolicy="no-referrer-when-downgrade" src="https://m0g1.uber.space/piwik/matomo.php?idsite=15&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->
</body>
</html>