Skip to content

feat(v2): allow to specify different logo for dark mode - #2261

Merged
lex111 merged 2 commits into
facebook:masterfrom
lex111:logo-dark-mode
Feb 1, 2020
Merged

lex111 merged 2 commits into
facebook:masterfrom
lex111:logo-dark-mode

Conversation

@lex111

@lex111 lex111 commented Jan 31, 2020

Copy link
Copy Markdown
Contributor

Motivation

Resolving of https://docusaurus.canny.io/admin/board/feature-requests/p/specify-different-dark-mode-logo

Since we have dark mode enabled by default, it makes sense to give our users the ability to set a different logo for dark mode.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Specify logo.darkSrc filed and switch to dark mode to make sure the logo has changed.

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 Jan 31, 2020
@lex111
lex111 requested a review from yangshun January 31, 2020 22:01
@lex111
lex111 requested a review from wgao19 as a code owner January 31, 2020 22:01
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 31, 2020
}
: null;
const logoImageUrl = useBaseUrl(logo.src);
const logoSrc = logo.darkSrc && isDarkTheme ? logo.darkSrc : logo.src;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe is it better to move this expression to the hook call?

const logoImageUrl = useBaseUrl(logo.darkSrc && isDarkTheme ? logo.darkSrc : logo.src);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both are acceptable.

Comment thread website/docs/theme-classic.md Outdated
logo: {
alt: 'Site Logo',
src: 'img/logo.svg',
darkSrc: 'img/logo_dark.svg', // default to logo.src

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe is it better to rename to srcDark or just dark?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think srcDark would be better.

@docusaurus-bot

docusaurus-bot commented Jan 31, 2020

Copy link
Copy Markdown
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit c80c00c

https://deploy-preview-2261--docusaurus-2.netlify.com

@yangshun yangshun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome, self-merge please!

Comment thread website/docs/theme-classic.md Outdated
logo: {
alt: 'Site Logo',
src: 'img/logo.svg',
darkSrc: 'img/logo_dark.svg', // default to logo.src

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think srcDark would be better.

}
: null;
const logoImageUrl = useBaseUrl(logo.src);
const logoSrc = logo.darkSrc && isDarkTheme ? logo.darkSrc : logo.src;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both are acceptable.

@lex111
lex111 merged commit 9807552 into facebook:master Feb 1, 2020
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
* feat(v2): allow to specify different logo for dark mode

* Rename darkSrc with srcDark
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.

4 participants