iamkun / iamkun/dayjs

Feature Request: Add Theme Toggler to Documentation Site

Open
#2,964 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

### **Goals**

1. Introduce a **Theme Toggler** (Light/Dark mode) to enhance user accessibility and comfort.
2. Improve the developer experience when browsing docs in different lighting conditions.
3. Align with modern web UI standards and improve visual consistency.

---

### **Non-Goals**

1. No major redesign of the documentation layout.
2. No change in content or documentation structure.
3. No dependency on external theming frameworks unless required by the site’s tech stack.

---

### **Background**

Currently, the Day.js documentation uses a static light theme, which can be uncomfortable during night-time browsing or long reading sessions.
Adding a theme toggler improves readability and follows best practices used by most modern documentation sites such as **React, Next.js, and MDN**.

---

### **Proposal**

- Add a **Theme Toggle Button** (e.g., 🌞 / 🌙) in the top-right corner of the navigation bar.
- Store user preference using **localStorage** so that the chosen theme persists across sessions.
- Support both **Light** and **Dark** themes using CSS variables or a small JS toggle script.
- Optional: Detect system theme preference (`prefers-color-scheme`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.