Skip to content

Commit b86a951

Browse files
committed
Accessibility: Improve Color Contrast in Dark Mode (WCAG 2.1 AA Compliance) #449
1 parent ed15792 commit b86a951

File tree

5 files changed

+242
-139
lines changed

5 files changed

+242
-139
lines changed

src/app/component/activity-description/activity-description.component.css

Lines changed: 85 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@
3636
margin-bottom: 10px;
3737
color: var(--text-tertiary);
3838
}
39+
3940
.activity-subheader .level {
4041
min-width: fit-content;
4142
}
43+
4244
.activity-subheader .uuid {
4345
text-align: end;
4446
}
47+
4548
.activity-subheader .uuid-label {
46-
font-size: 12px;
47-
margin-right: 0.1em;
48-
}
49+
font-size: 12px;
50+
margin-right: 0.1em;
51+
}
4952

5053
.close-button {
5154
flex-shrink: 0;
@@ -150,11 +153,36 @@ mat-panel-title b {
150153
}
151154

152155
/* Level-based coloring for difficulty */
153-
.level-1 { background-color: #e8f5e8; color: #2e7d32; } /* Light green */
154-
.level-2 { background-color: #e0f2e7; color: #388e3c; } /* Medium green */
155-
.level-3 { background-color: #fff8e1; color: #f57c00; } /* Light orange */
156-
.level-4 { background-color: #fff3e0; color: #ef6c00; } /* Medium orange */
157-
.level-5 { background-color: #ffebee; color: #c62828; } /* Light red */
156+
.level-1 {
157+
background-color: #e8f5e8;
158+
color: #2e7d32;
159+
}
160+
161+
/* Light green */
162+
.level-2 {
163+
background-color: #e0f2e7;
164+
color: #388e3c;
165+
}
166+
167+
/* Medium green */
168+
.level-3 {
169+
background-color: #fff8e1;
170+
color: #f57c00;
171+
}
172+
173+
/* Light orange */
174+
.level-4 {
175+
background-color: #fff3e0;
176+
color: #ef6c00;
177+
}
178+
179+
/* Medium orange */
180+
.level-5 {
181+
background-color: #ffebee;
182+
color: #c62828;
183+
}
184+
185+
/* Light red */
158186

159187
/* Usefulness Section Styling */
160188
.usefulness-section {
@@ -180,9 +208,10 @@ mat-panel-title b {
180208
}
181209

182210
mat-icon.mat-icon {
183-
width: fit-content;
184-
height: fit-content;
211+
width: fit-content;
212+
height: fit-content;
185213
}
214+
186215
.usefulness-stars {
187216
display: flex;
188217
align-items: center;
@@ -322,35 +351,35 @@ mat-icon.mat-icon {
322351
grid-template-columns: repeat(2, 1fr);
323352
gap: 15px;
324353
}
325-
354+
326355
.references-summary {
327356
/* flex-wrap: wrap; */
328357
gap: 10px;
329358
}
330-
359+
331360
.ref-section {
332361
flex: 0 1 48%;
333362
}
334-
363+
335364
}
336365

337366
@media (max-width: 350px) {
338367
.references-grid {
339368
grid-template-columns: 1fr;
340369
gap: 10px;
341370
}
342-
371+
343372
.references-summary {
344373
flex-direction: column;
345374
gap: 8px;
346375
}
347-
376+
348377
.ref-section {
349378
flex: 1;
350379
flex-direction: row;
351380
gap: 8px;
352381
}
353-
382+
354383
.ref-section strong {
355384
min-width: 80px;
356385
flex-shrink: 0;
@@ -436,12 +465,47 @@ mat-icon.mat-icon {
436465
transition: background-color 0.2s, transform 0.1s;
437466
}
438467

468+
469+
470+
/* 1. Light Mode (Default) */
471+
.level,
472+
.uuid {
473+
color: rgb(64, 64, 64) !important;
474+
}
475+
476+
/* 2. Dark Mode (When .dark-theme is active on body) */
477+
:host-context(body.dark-theme) .level,
478+
:host-context(body.dark-theme) .uuid {
479+
color: rgb(224, 224, 224) !important;
480+
}
481+
482+
439483
/* Dark Mode Support */
440484
@media (prefers-color-scheme: dark) {
485+
441486
/* Level badges in dark mode - maintain readability */
442-
.level-1 { background-color: #2e7d32; color: #e8f5e8; }
443-
.level-2 { background-color: #388e3c; color: #e0f2e7; }
444-
.level-3 { background-color: #f57c00; color: #fff8e1; }
445-
.level-4 { background-color: #ef6c00; color: #fff3e0; }
446-
.level-5 { background-color: #c62828; color: #ffebee; }
487+
.level-1 {
488+
background-color: #2e7d32;
489+
color: #e8f5e8;
490+
}
491+
492+
.level-2 {
493+
background-color: #388e3c;
494+
color: #e0f2e7;
495+
}
496+
497+
.level-3 {
498+
background-color: #f57c00;
499+
color: #fff8e1;
500+
}
501+
502+
.level-4 {
503+
background-color: #ef6c00;
504+
color: #fff3e0;
505+
}
506+
507+
.level-5 {
508+
background-color: #c62828;
509+
color: #ffebee;
510+
}
447511
}

0 commit comments

Comments
 (0)