Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): add ability set dark mode by default #2597

Merged
merged 2 commits into from
Apr 17, 2020

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Apr 13, 2020

Motivation

Resolve #2565 and corresponding request on Canny (https://docusaurus.canny.io/admin/board/feature-requests/p/default-to-dark-theme)

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

  1. Make sure that there is no saved proffered theme in local storage (theme key) and add the themeConfig.forceDarkMode=true option in the config file.

  2. Now when you open the website, dark mode will be turned on (light mode can be selected via navbar toggle)

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: new feature This PR adds a new API or behavior. label Apr 13, 2020
@lex111 lex111 added this to the v2.0.0-alpha.51 milestone Apr 13, 2020
@lex111 lex111 requested review from wgao19 and yangshun as code owners April 13, 2020 09:27
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 13, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Apr 13, 2020

Deploy preview for docusaurus-2 ready!

Built with commit 6a4a30e

https://deploy-preview-2597--docusaurus-2.netlify.app

Copy link
Contributor

@fanny fanny left a comment

Choose a reason for hiding this comment

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

Your PR looks great. But just for curiosity, why do we need to have a string with js functions?

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

Just a suggestion on the naming.

module.exports = {
// ...
themeConfig: {
forceDarkMode: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

defaultDarkMode would be a better name IMO. forceDarkMode sounds like we're forcing the site to be permanently in dark mode.

@yangshun yangshun merged commit 14f4ef8 into master Apr 17, 2020
@yangshun yangshun deleted the lex111/default-dark-mode branch April 17, 2020 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to set dark mode as default
5 participants