-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.njk
120 lines (108 loc) · 3.6 KB
/
index.njk
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
110
111
112
113
114
115
116
117
118
119
120
{% extends "layouts/main.njk" %}
{% block content %}
<style>
/* initial colours */
:root {
--app-input-page-background: {{ input.pageBackground }};
--app-input-object-background: {{ input.objectBackground }};
--app-input-text-color: {{ input.textColour }};
--app-object-contrast-with-page-color: {{ objectContrastWithPage.status.color }};
--app-text-contrast-with-object-color: {{ textContrastWithObject.status.color }};
}
</style>
<h1 class="govuk-heading-xl">Contrast Checker</h1>
<div class="app-grid">
<div class="app-grid-column">
<form>
{{ govukInput({
classes: "govuk-input--width-5",
label: {
text: "Text colour"
},
id: "textColour",
name: "textColour",
value: input.textColour,
attributes: {
autocomplete: "off",
autocorrect: "off",
spellcheck: "off"
}
}) }}
{{ govukInput({
classes: "govuk-input--width-5",
label: {
text: "Object background"
},
id: "objectBackground",
name: "objectBackground",
value: input.objectBackground,
attributes: {
autocomplete: "off",
autocorrect: "off",
spellcheck: "off"
}
}) }}
{{ govukInput({
classes: "govuk-input--width-5",
label: {
text: "Page background"
},
id: "pageBackground",
name: "pageBackground",
value: input.pageBackground,
attributes: {
autocomplete: "off",
autocorrect: "off",
spellcheck: "off"
}
}) }}
{{ govukButton({
text: "Reset",
type: "reset"
}) }}
{{ govukButton({
text: "Update"
}) }}
</form>
</div>
<div class="app-grid-column">
<div class="app-input-page">
<div class="app-input-object">
Text
</div>
</div>
</div>
<div class="app-grid-column" aria-live="polite">
<h2 class="govuk-heading-s">Text contrast with object background</h2>
<p class="govuk-heading-l govuk-!-margin-bottom-0" data-app-text-contrast-with-object-status-title
style="color: var(--app-text-contrast-with-object-color);">
{{ textContrastWithObject.status.title }}
</p>
<p class="govuk-heading-xl govuk-!-margin-bottom-0">
<span data-app-text-contrast-with-object-contrast-ratio>
{{- textContrastWithObject.contrastRatio -}}
</span>:1
</p>
<p class="govuk-!-margin-bottom-7">
<a class="govuk-link" href="https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum">
Understanding Success Criterion 1.4.3: Contrast (Minimum)
</a>
</p>
<h2 class="govuk-heading-s">Object contrast with page background</h2>
<p class="govuk-heading-l govuk-!-margin-bottom-0" data-app-object-contrast-with-page-status-title
style="color: var(--app-object-contrast-with-page-color);">
{{ objectContrastWithPage.status.title }}
</p>
<p class="govuk-heading-xl govuk-!-margin-bottom-0">
<span data-app-object-contrast-with-page-contrast-ratio>
{{- objectContrastWithPage.contrastRatio -}}
</span>:1
</p>
<p>
<a class="govuk-link" href="https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast">
Understanding Success Criterion 1.4.11: Non-text Contrast
</a>
</p>
</div>
</div>
{% endblock %}