forked from siege-media/contrast-ratio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
65 lines (49 loc) · 2.83 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Contrast Ratio: Easily calculate color contrast ratios. Passing WCAG was never this easy!</title>
<link rel="stylesheet" href="style.css" />
<link rel="shortcut icon" type="image/png" href="about:blank" />
<script src="prefixfree.min.js"></script>
</head>
<body>
<h1><a href="#"><div><span>Contrast</span></div> <div><strong>ratio</strong></div></a></h1>
<label class="background">
<span>Background:</span>
<input id="background" value="white" autofocus />
</label>
<label class="foreground">
<span>Text color:</span>
<input id="foreground" value="hsla(200,0%,0%,.7)" />
</label>
<output tabindex="0">
<strong>?</strong>
<span class="error"></span>
</output>
<section id="results">
</section>
<section class="color-display" id="backgroundDisplay">
<h1>How to use</h1>
<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 or <strong>bold</strong> 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="http://lea.verou.me" target="_blank">Lea Verou</a>
• <a href="http://www.w3.org/TR/WCAG/#visual-audio-contrast" target="_blank">WCAG 2.0 on contrast ratio</a>
</footer>
</section>
<section class="color-display" id="foregroundDisplay">
<button id="swap">Set as background color</button>
</section>
<footer></footer>
<script src="https://leaverou.github.com/incrementable/incrementable.js" id="incrementable" async></script>
<script src="color.js"></script>
<script src="contrast-ratio.js"></script>
<script>_gaq = [['_setAccount', 'UA-25106441-2'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
<a href="https://github.com/LeaVerou/contrast-ratio"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_orange_ff7600.png" alt="Fork me on GitHub"></a>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="LeaVerou" data-size="large" data-related="w3c_wai">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</body>
</html>