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

T345056: dark mode support #110

Merged
merged 16 commits into from
Apr 5, 2024
Merged

Conversation

medied
Copy link
Contributor

@medied medied commented Mar 19, 2024

src/link/colorScheme.js Outdated Show resolved Hide resolved
Copy link
Contributor

@stephanebisson stephanebisson left a comment

Choose a reason for hiding this comment

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

Looking good! Just a few code hygiene comments inline.

src/init.js Outdated
init( getColorScheme() );

// Re-init as needed as the color scheme changes
observeDarkModePluginActivation( ( scheme ) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could further simplify by passing the function directly instead of creating a lambda with the same signature as the function.

const attNameWPDarkModePlugin = 'data-wp-dark-mode-active';

const isWPDarkModePluginActive = () => {
const htmlTag = document.documentElement;
Copy link
Contributor

Choose a reason for hiding this comment

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

No real use for the htmlTag variable

src/link/colorScheme.js Outdated Show resolved Hide resolved
}
} );

observer.observe( htmlTag, { attributes: true } );
Copy link
Contributor

Choose a reason for hiding this comment

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

No real use for the htmlTag variable

@medied medied changed the title T345056: dark mode with observer T345056: dark mode support Mar 20, 2024
@medied medied marked this pull request as ready for review March 20, 2024 17:47
src/link/colorScheme.js Outdated Show resolved Hide resolved
src/link/colorScheme.js Outdated Show resolved Hide resolved
Copy link
Member

@hueitan hueitan left a comment

Choose a reason for hiding this comment

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

LGTM.

@stephanebisson stephanebisson merged commit 72f4c09 into main Apr 5, 2024
1 check passed
@stephanebisson stephanebisson deleted the T345056-dark-mode-second-observer branch April 5, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants