Skip to content

Commit 734981c

Browse files
committed
Created dark mode blog post
1 parent 03cc73f commit 734981c

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
77.6 KB
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: "Syed Khubayb Ur Rahman"
3+
slug: "syed-khubayb-ur-rahman"
4+
title: "Contributor"
5+
organization: "SugarLabs"
6+
description: "Contributor at Sugar Labs"
7+
avatar: "https://avatars.githubusercontent.com/u/193499370?v=4"
8+
9+
---
10+
11+
<!--markdownlint-disable-->
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: "Adding Dark Mode to a Sugar Labs Website"
3+
excerpt: "I added dark mode to a Sugar Labs web project—here’s the problem I hit, how I debugged it, and what I learned."
4+
category: "DEVELOPER NEWS"
5+
date: "2025-10-04"
6+
slug: "adding-dark-mode-to-sugar-labs"
7+
author: "@/constants/MarkdownFiles/authors/syed-khubayb-ur-rahman.md"
8+
tags: "dark-mode,accessibility,frontend,Sugar Labs"
9+
image: "assets/Images/dark-mode.webp"
10+
---
11+
12+
<!-- markdownlint-disable -->
13+
14+
# Adding Dark Mode to a Sugar Labs Website
15+
16+
## Introduction
17+
Sugar Labs builds open-source tools that make learning playful and accessible. I recently contributed dark mode to a Sugar Labs web project. This post outlines the problem I encountered, how I debugged and fixed it, and the key lessons I learned so others can ship accessible theming with confidence.
18+
19+
## The Problem
20+
The Sugar Labs website originally lacked a Dark Mode option, which made browsing less comfortable in low-light conditions. This was particularly noticeable for developers and users who preferred darker themes.
21+
22+
Without dark mode, the bright interface could cause eye strain and reduce accessibility for users with light sensitivity.
23+
- **Goal:** Deliver a robust dark mode that respects system preference, includes a manual toggle with persistence, and maintains accessible contrast across the interface.
24+
25+
## Debugging and Solution
26+
- **Color audit and mapping:** I inventoried all color usages, identified hardcoded values, and grouped them into semantic tokens (background, text, muted, accent, surface). This created a maintainable foundation for theming.
27+
- **Single source of truth:** I centralized color decisions via tokens instead of scattering values across files and components. This reduced duplication and made changes less error‑prone.
28+
- **Preference‑aware default:** I ensured the theme respects the user’s system setting when no explicit preference is stored, providing a sensible baseline experience.
29+
- **Manual toggle with persistence:** I added a simple theme switch that remembers the user’s choice across sessions for predictability and control.
30+
- **Component‑wide updates:** I refactored buttons, inputs, cards, alerts, focus rings, and states (hover, active, disabled) to use tokens. Each state was validated for contrast in both themes.
31+
- **Icons and media adjustments:** I standardized icons to adapt to the active theme and introduced subtle borders/surfaces to preserve structure on dark backgrounds.
32+
- **Accessibility validation:** I checked contrast ratios, improved focus visibility, and tested keyboard navigation and zoom to ensure inclusive design.
33+
- **Cross‑browser and performance checks:** I verified behavior across major browsers and optimized the switch to be instantaneous by relying on theme variables rather than heavy DOM updates.
34+
35+
## Challenges and Takeaways
36+
- **Third‑party components:** Some libraries hardcoded their colors. Carefully scoped overrides and mapping external variables to our tokens aligned them with the overall theme.
37+
- **Brand color tuning:** The primary accent required adjustments for dark backgrounds. Preserving hue while tweaking lightness/saturation retained brand identity and improved legibility.
38+
- **Legacy inline styles:** Inline color rules resisted theming. Moving values into tokens eliminated one‑off overrides and simplified maintenance.
39+
- **Documentation as leverage:** I documented the token system and theme architecture. Clear guidelines made it easier for future contributors to build consistently.
40+
- **Accessibility‑first mindset:** Dark mode is not color inversion. Designing for contrast, depth, and hierarchy from the start avoids costly rework later.
41+
42+
## Impact and Conclusion
43+
- **Impact on users:** Reduced eye strain, improved readability, and a cohesive experience—especially valuable for users with light sensitivity.
44+
- **Impact on the project:** A unified token system speeds up future development, theming, and contributor onboarding.
45+
- **Community value:** The approach respects user preferences, provides control, and centers accessibility—principles aligned with Sugar Labs’ mission.
46+
47+
By sharing my experience, I hope to inspire others to contribute to Sugar Labs and make a positive impact on the community. Start by defining semantic tokens, honoring system preferences, and prioritizing accessibility—you’ll deliver a dark mode that feels natural, inclusive, and maintainable.

0 commit comments

Comments
 (0)