macos_ui icon indicating copy to clipboard operation
macos_ui copied to clipboard

Leverage `EventChannel` to listen for the system accent color

Open GroovinChip opened this issue 3 years ago • 4 comments

Currently, we are hardcoding the bizarrely-named MacosColors.controlAccentColor, which is the user's selected system accent color. (Obviously this name doesn't make much sense, but that's what Apple calls it...).

Obviously, someone making a macOS application would expect that their choice of system-level accent color would be reflected in their application unless explicitly overridden. Since macos_ui is now a plugin, we can leverage Flutter's EventChannel to listen to the native controlAccentColor's value.

This would require some refactoring to MacosColors since controlAccentColor is a static value. I'm not quite certain the best way to proceed with this at this time.

GroovinChip avatar May 11 '22 00:05 GroovinChip

Could this be of any help?

whiplashoo avatar May 11 '22 07:05 whiplashoo

Also, a more complete way of getting the accent color.

whiplashoo avatar May 15 '22 19:05 whiplashoo

Also, a more complete way of getting the accent color.

Okay, I have done a first pass on this feature via the code found above. It should be noted that this is done through MethodChannel, though, not EventChannel. I tried doing that and I kept getting null back for the color. See this gist for more on that attempt.

This code is available to browse in the accent_color_listener branch

GroovinChip avatar Jul 09 '22 17:07 GroovinChip

@Adrian-Samoticha this is relevant to our accuracy work.

GroovinChip avatar Mar 21 '23 15:03 GroovinChip