Skip to content

feat: add new nativeTheme API - #19656

Merged
MarshallOfSound merged 5 commits into
masterfrom
native-theme
Aug 14, 2019
Merged

MarshallOfSound merged 5 commits into
masterfrom
native-theme

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

This adds a new nativeTheme API which extracts APIs from systemPreferences (which was becoming a bit of a dumping ground) and consolidates them all to be backed by Chromium's NativeTheme module which is better implemented, more resilient and means we don't have to maintain the theme code 👍

It also allows us to easily implement the updated event.

Notes: Added new nativeTheme API to read and respond to changes in the OS's theme and color scheme

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 6, 2019
@MarshallOfSound MarshallOfSound added target/7-0-x semver/minor backwards-compatible functionality labels Aug 6, 2019
@deermichel

Copy link
Copy Markdown
Contributor

Now we're talking 🎉

@deermichel
deermichel self-requested a review August 6, 2019 23:12

@deermichel deermichel 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.

Lots of nits 😆 - super sorry. Additionally:

  • Did you miss module-keys.js or isn't it used anymore?
  • nativeTheme.shouldUseInvertedColorScheme doesn't work on macOS for me (always false), but update event gets fired when I toggle it
  • Afaik, the nativeTheme methods on Linux aren't implemented and default to some value - we should state that
  • Oh and we have some fake tests for the sysPref methods - do we wanna move them to a new nativeThemeSpec?

Comment thread docs/api/native-theme.md Resolved
Comment thread docs/api/native-theme.md Resolved
Comment thread docs/api/native-theme.md Resolved
Comment thread docs/api/system-preferences.md Resolved
Comment thread docs/api/system-preferences.md Resolved
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Aug 7, 2019
@MarshallOfSound

Copy link
Copy Markdown
Member Author

Did you miss module-keys.js or isn't it used anymore?

module-keys.js is only used for browser APIs. These APIs are in common.

nativeTheme.shouldUseInvertedColorScheme doesn't work on macOS for me (always false), but update event gets fired when I toggle it

This API is only implemented on Windows inside Chromium, it's a one liner to implement on macOS so I'll do that here as well.

Afaik, the nativeTheme methods on Linux aren't implemented and default to some value - we should state that

Potentially, will have to review which APIs are implemented for linux 👍

Oh and we have some fake tests for the sysPref methods - do we wanna move them to a new nativeThemeSpec?

New tests should be added here that the APIs "work"

Comment thread docs/api/native-theme.md Resolved

@deermichel deermichel 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.

LGTM 🚢

Comment thread lib/common/api/deprecate.ts Resolved
@MarshallOfSound
MarshallOfSound merged commit efa1818 into master Aug 14, 2019
@release-clerk

release-clerk Bot commented Aug 14, 2019

Copy link
Copy Markdown

Release Notes Persisted

Added new nativeTheme API to read and respond to changes in the OS's theme and color scheme

@MarshallOfSound
MarshallOfSound deleted the native-theme branch August 14, 2019 20:42
@trop trop Bot mentioned this pull request Aug 14, 2019
@trop

trop Bot commented Aug 14, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "7-0-x", please check out #19758

@damienallen

Copy link
Copy Markdown

Just updated today and didn't even know this was coming, awesome 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants