File size: 1,132 Bytes
ef987bb
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Add a one-click theme switch to the discussion page

Extend the supplied `index.html` with a prominent button that switches the whole page between light and dark modes. Keep it usable offline.

## Interface

Mark the button with `data-testid="theme-toggle"`. Preserve the supplied contents and `data-testid` values `question-list`, `question-detail` and `comment-area`. Either theme may be initial; no CSS class, theme attribute or storage key is prescribed.

## Acceptance Checklist

- One click switches both the body and all three regions in the same direction. The dark background is less luminous than the light background in each. A brief transition is allowed if it settles within five seconds.
- Each effective background changes by at least 32 on the weighted RGB scale `0.2126R + 0.7152G + 0.0722B`, using 0–255 channel values. Transparent regions may inherit their parent backgrounds.
- Repeated clicks alternate between the same two visual states; ten toggles restore the initial state. A refresh preserves the selected theme between clicks.
- Toggling and refreshing do not alter page text or cause browser errors.