Skip to content

Incorrect values from systemPreferences.getAccentColor() #27048

@jcarpenter

Description

@jcarpenter

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • v11.0.3
  • Operating System:
    • macOS 11.0.1 (Big Sur)

Expected Behavior

Values returned from systemPreferences.getAccentColor() should match actual system accent colors.

Actual Behavior

Values returned by Electron are slightly off (too dark).

Here's a comparison of 1) values returned from a native app querying the value of controlAccentColor on Big Sur, and 2) systemPreferences.getAccentColor(), which also queries controlAccentColor. Color column denotes the built-in accent color options in macOS (in System Preferences > General > Accent color).

Color Native Electron
Blue #007AFFFF #0A5FFFFF
Purple #A550A7FF #923796FF
Pink #F74F9EFF #F2318DFF
Red #FF5257FF #FC3845FF
Orange #F7821BFF #F36D16FF
Yellow #FFC600FF #FEBC09FF
Green #62BA46FF #53B036FF
Graphite #8C8C8CFF #797979FF

The values returned from getAccentColor are just a bit too dark. And if they're not accurate, they're not very useful, since the point of using getAccentColor is to create UI elements that match the user's OS exactly.

To Reproduce

Here's a gist with a bit of swift for outputting the value of NSColor.controlAccentColor.

Screenshots

Here's what the delta looks like:

electron-accentColors-test

Additional Information

The problem might lie in how the value is being converted and returned: return base::SysNSStringToUTF8([sysColor RGBAValue]);
🤷‍♀️

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions