Skip to content

Conversation

JerryWu1234
Copy link
Contributor

@JerryWu1234 JerryWu1234 commented Oct 10, 2025

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests / types / typos
  • Infra

Description

Feature: Add System-Sync ("Auto") Theme to Docs

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I made corresponding changes to the Qwik docs
  • I added new tests to cover the fix / functionality

- Added dark mode support in global CSS with new color variables.
- Refactored ThemeScript component to improve theme preference handling.
- Updated theme toggle components to accept class props for better styling.
- Simplified theme toggle logic in ThemeToggle component.
- Removed deprecated ThemeScript import from root component.
- Cleaned up unused CSS styles related to theme toggle.
Copy link

changeset-bot bot commented Oct 10, 2025

⚠️ No Changeset found

Latest commit: 12441e5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JerryWu1234 JerryWu1234 self-assigned this Oct 10, 2025
Copy link
Contributor

github-actions bot commented Oct 10, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 12441e5

@maiieul maiieul changed the title Light mode dark mode docs: light mode dark mode Oct 10, 2025
- Added CSS rules for dark mode image filtering and temporary workarounds.
- Updated theme toggle components to remove unused imports and streamline code.
- Introduced light mode styles for ecosystem elements based on user preferences.
- Added dark mode styles for various components including code sandbox and API documentation.
- Removed sun-and-moon theme toggle components and associated CSS to streamline the codebase.
- Updated theme icon styles for better responsiveness and consistency.
@JerryWu1234 JerryWu1234 marked this pull request as ready for review October 13, 2025 05:50
@JerryWu1234 JerryWu1234 requested a review from a team as a code owner October 13, 2025 05:50
Copy link
Member

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help @JerryWu1234
with this change the top right icons are not visible anymore. 🤔

Image

@JerryWu1234
Copy link
Contributor Author

Thanks for your help @JerryWu1234 with this change the top right icons are not visible anymore. 🤔

Image

https://qwik.dev/
please look at the official website

Copy link
Member

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, can you fix this issue as well please?

@JerryWu1234
Copy link
Contributor Author

I see, can you fix this issue as well please?

done

Copy link
Member

@wmertens wmertens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start!

I also noticed that on mobile the icon is not centered. But on mobile it would be better to have the text in addition to the icon.

background-color: #161616;
}

@media (prefers-color-scheme: dark) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all these dark mode changes should only look at data-theme.

stroke-linecap: round;
html[data-theme='light'] .themeIcon.light,
html[data-theme='dark'] .themeIcon.dark,
html:not([data-theme]) .themeIcon.auto {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data-theme should always hold the current theme even if it's auto. That way the css is much simpler.

So for auto mode we need a different prop. Maybe data-theme-name? Then all three icons can check that. And data-theme basically only ever contains "dark" (unless we add more themes).

export type ThemePreference = 'dark' | 'light' | 'auto';
export const setPreference = (theme: ThemePreference) => {
if (theme === 'auto') {
document.firstElementChild?.removeAttribute('data-theme');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it should pick the media query answer

[data-theme="dark"] .docs.api table {
box-shadow: 0 0 30px 0 rgba(80,80,80,0.1);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this extra space get here?

We should make sure prettier also formats these files

- Removed dark mode CSS rules from global styles and various components to simplify the codebase.
- Updated theme toggle logic to improve responsiveness and ensure consistent theme application based on user preferences.
- Enhanced theme script to handle theme attributes more robustly.
- Changed the fill attribute in Discord, GitHub, and Twitter logo SVGs from a specific color to 'currentColor' for better adaptability in different themes.
- Cleaned up unnecessary CSS rules in the API styles to enhance maintainability.
- Moved the ThemeScript import to the theme-toggle component for better structure.
- Removed the obsolete theme-script file to clean up the codebase.
- Updated the colorSchemeChangeListener import to reflect the new file structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants