-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-light-dark-high-examples.html
92 lines (77 loc) · 2.82 KB
/
03-light-dark-high-examples.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Light, Dark and High Contrast Mode</title>
<style>
/* ========== Colour Variables ========== */
:root {
color-scheme: light dark;
--height: 30vw;
/* your light theme colours */
--color-bg: hsl(0, 0%, 94%);
--color-bg-box: hsl(0, 0%, 75%);
--color-text: hsl(0, 0%, 16%);
--color-link: hsl(0, 0%, 39%);
}
@media (prefers-color-scheme: dark) {
:root {
/* your dark theme colours; overwrites the light theme colours */
--color-bg: hsl(0, 0%, 20%);
--color-bg-box: hsl(0, 0%, 20%);
--color-text: hsl(0, 0%, 85%);
--color-link: hsl(0, 0%, 75%);
}
}
@media (forced-colors) {
:root {
/* your high contrast theme colours; overwrites the light and dark theme colours */
--color-bg: Canvas;
--color-bg-box: Canvas;
--color-text: CanvasText;
--color-link: ActiveText;
fill: var(--color-text);
}
}
/* ========== Styles ========== */
* {
font: normal 400 100%/1.4 sans-serif;
box-sizing: border-box;
}
body {
background-color: var(--color-bg);
}
</style>
</head>
<body>
<h1>SVG</h1>
<h2>Example 1 – without Transition/Animation</h2>
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="140" viewBox="0 0 500 140">
<title>SVG Text Example 1</title>
<text x="0" y="35">
Legibility rulez. <tspan x="25" dy="2em">Usability for all!</tspan>
</text>
</svg>
<h2>Example 2 – without Transition/Animation</h2>
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="140" viewBox="0 0 500 140">
<title>SVG Text Example 1</title>
<text x="0" y="35" transform="rotate(30 20,40)">
Legibility rulez. <tspan x="25" dy="2em">Usability for all!</tspan>
</text>
</svg>
<h3>Example with referenced text</h3>
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="140" viewBox="0 0 500 140">
<title>SVG Text Example 3</title>
<defs>
<text id="theText">Usability for all!</text>
</defs>
<text x="10" y="10">
<tref xlink:href="#theText" />
</text>
</svg>
<h3>Example with Shadow-Focus</h3>
<p>This is an element with a CSS shadow focus. This isn't available in HCM</p>
<a class="shadow-focus" href="#">Link</a>
</body>
</html>