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: systemPreferences.getColor should return RGBA instead of RGB #38960

Merged
merged 5 commits into from Sep 28, 2023

Conversation

ILikeTeaALot
Copy link
Contributor

Description of Change

Fully completes #26628

This fix implements the change requested in #26628, as stated there due to low usage of the API and the fact that returning a hex colour with alpha appended to the end should not cause any breaking changes, this is not marked as breaking.

(I don't have a recent-enough Mac to compile the code, so I would be immensely greatful for someone to take the time to do the necessary tests.)

The same change has not been made to the Windows version as no Windows system colour use alpha, however it could easily be changed as well for consistency.

Checklist

No test changes are necessary, but as noted above I've been unable to run them myself.

Release Notes

Notes: Changed systemPreferences.getColor(name) to return an RGBA hex value (#RRGGBBAA) instead of a plain RGB (#RRGGBB) value.

@welcome
Copy link

welcome bot commented Jun 30, 2023

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 30, 2023
@VerteDinde VerteDinde added the semver/patch backwards-compatible bug fixes label Jul 3, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jul 3, 2023
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

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

It was not settled that this kind of change should be a fix in #26628. The PR #30055 that changed getSystemColor to return RGBA was a fix because the document stated the API returned RGBA but the code did not.

Having said that I do think it is fine to mark this change as fix though, but it should be @electron/wg-api to decide.

Also the return value should also be changed on Windows/Linux too, even if those platforms do not use transparent colors we should still fill the value with a FF alpha value.

@jkleinsc jkleinsc added semver/minor backwards-compatible functionality and removed semver/patch backwards-compatible bug fixes labels Jul 26, 2023
Copy link
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

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

API LGTM

I agree with @zcbenz that the alpha channel FF should be added for consistency.

@itsananderson
Copy link
Contributor

API LGTM

+1 for including FF on Win/Linux for consistency

@jkleinsc
Copy link
Contributor

jkleinsc commented Aug 3, 2023

@ILikeTeaALot can you address @zcbenz's concerns?

@ILikeTeaALot
Copy link
Contributor Author

@jkleinsc Happy to! Apologies I didn't see the activity on this PR.

The Windows version should work exactly the same now.

Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

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

API LGTM

@codebytere codebytere changed the title fix: change systemPreferences.getColor to return RGBA instead of RGB feat:systemPreferences.getColor should return RGBA instead of RGB Sep 25, 2023
@codebytere codebytere changed the title feat:systemPreferences.getColor should return RGBA instead of RGB feat: systemPreferences.getColor should return RGBA instead of RGB Sep 25, 2023
Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

API LGTM

@jkleinsc jkleinsc merged commit d002f16 into electron:main Sep 28, 2023
14 checks passed
@welcome
Copy link

welcome bot commented Sep 28, 2023

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk
Copy link

release-clerk bot commented Sep 28, 2023

Release Notes Persisted

Changed systemPreferences.getColor(name) to return an RGBA hex value (#RRGGBBAA) instead of a plain RGB (#RRGGBB) value.

MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
…lectron#38960)

* fix: return RGBA hex value from `SystemPreferences.getColor`

* docs: update docs to match changes of last commit

* fix: GetColor on windows now returns RGBA too

* fix: update tests for getColor RGBA on Windows

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants