Skip to content

feat: add {get|set}AccentColor on Windows #47741

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Jul 14, 2025

Description of Change

Closes #47584.

Adds the ability to change window accent color on Windows after initial window initialization.

cc @bpasero

Demo

https://gist.github.com/237ddda00daa4fe47fe7b11a4abd9f61

rainbow

Checklist

Release Notes

Notes: Adds the ability to change window accent color on Windows after initial window initialization via {get|set}AccentColor.

@codebytere codebytere requested review from deepak1556, mlaurencin and a team July 14, 2025 08:39
@codebytere codebytere added semver/minor backwards-compatible functionality target/36-x-y PR should also be added to the "36-x-y" branch. target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. labels Jul 14, 2025
@bpasero
Copy link
Contributor

bpasero commented Jul 14, 2025

@codebytere nice, just to clarify: this method - when called - changes the option only for the window its called on, it will not impact other windows? So essentially each window can have its own behaviour around accentColor?

@codebytere
Copy link
Member Author

@bpasero yes, correct!

@codebytere codebytere force-pushed the fix-accent-color-for-changes branch 3 times, most recently from 41e722c to 9daba33 Compare July 14, 2025 11:13
@codebytere codebytere force-pushed the fix-accent-color-for-changes branch from 9daba33 to 767e34c Compare July 14, 2025 14:02
@codebytere codebytere marked this pull request as draft July 14, 2025 16:52
@codebytere codebytere force-pushed the fix-accent-color-for-changes branch from 0cc62a7 to 9ab68b0 Compare July 14, 2025 18:48
@codebytere codebytere requested a review from deepak1556 July 15, 2025 07:46
@codebytere codebytere marked this pull request as ready for review July 15, 2025 07:47
Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

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

LGTM, minor nit

@codebytere codebytere force-pushed the fix-accent-color-for-changes branch from 9ab68b0 to d093701 Compare July 15, 2025 13:28
Copy link
Member

@itsananderson itsananderson left a comment

Choose a reason for hiding this comment

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

I'm wondering if it'd be better to have getAccentColor reflect what was passed to setAccentColor, rather than trying to insert the system color if accent_color_ is true. It feels weird for getAccentColor to return less granular information than what was passed into setAccentColor 🤔


Sets the system accent color and highlighting of active window border.

#### `win.getAccentColor()` _Windows_
Copy link
Member

Choose a reason for hiding this comment

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

It looks like with this API, it won't be possible to distinguish between a window which has its accent color pinned to the system accent color (e.g. via setAccentColor(true)) and a window that happens to have the same color as the system accent color (e.g. via setAccentColor(systemPreferences.getAccentColor())).

Do we want to have a way to explicitly check if a window's accent color follows the System Settings?


#### `win.getAccentColor()` _Windows_

Returns `string | null` - the system accent color and highlighting of active window border in RGB format.
Copy link
Member

Choose a reason for hiding this comment

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

This is documented as string | null but the implementation seems to be string | false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/requested 🗳 new-pr 🌱 PR opened recently semver/minor backwards-compatible functionality target/36-x-y PR should also be added to the "36-x-y" branch. target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to update accentColor for an existing window
4 participants