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

systemPreferences.getAccentColor returns wrong color if automatic color is selected in windows 10 #16545

Closed
Ahriana opened this issue Jan 25, 2019 · 4 comments
Labels

Comments

@Ahriana
Copy link

Ahriana commented Jan 25, 2019

  • Output of node_modules/.bin/electron --version: v4.0.2
  • Operating System (Platform and Version): Windows 10: Version 1809 (Build: 17763.253)

Expected Behavior
calling systemPreferences.getAccentColor() should return correct color no matter if automatic color is set in windows

Actual behavior
if using systemPreferences.on('accent-color-changed') when moving from manual color to automatic the event will fire twice, once with the correct color and immidiatly after with a diffrent color (which is diffrent depending on the pc not sure what causes the second color to be picked)

if systemPreferences.getAccentColor() is also called after this event from now on it will return the incorrect value

To Reproduce
in main.js

  mainWindow.webContents.once('dom-ready', () => {
    const color = systemPreferences.getAccentColor()
    console.log(color);
    systemPreferences.on('accent-color-changed', (event, color) => { console.log(color); })
  })

If you provide a URL, please list the commands required to clone/setup/run your repo e.g.

$ git clone https://github.com/RosieCode95/electron-quick-start.git
$ npm install
$ npm start

Screenshots
http://mei.is-a-good-waifu.com/233eba.mp4
video showing the issue in action

Additional Information
note: starting the application with automatic already set still returns incorrect color values

@welcome
Copy link

welcome bot commented Jan 25, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@Ahriana
Copy link
Author

Ahriana commented Jan 25, 2019

ok.. so..

after some more digging i went into source and found the 2 registry keys electron uses to get those colors ColorizationColor and AccentColor

so i made a scirpt to go in and check the registry manualy and display the output againt electrons.
the results show this is not a windows bug or random nonsence that windows has habbits of doing.
you can see the results here: http://mei.is-a-good-waifu.com/0d5e45.mp4

code:

const regedit = require('regedit')
const ipcRenderer = require('electron').ipcRenderer
ipcRenderer.on('dom-color', (event, color) => { go(color) })
function go(color) {
    regedit.list('HKCU\\Software\\Microsoft\\Windows\\DWM', function(err, result) {
        result = result['HKCU\\Software\\Microsoft\\Windows\\DWM'].values
        console.log('AccentColor', result.AccentColor.value, toHex(result.AccentColor.value))
        console.log('ColorizationColor', result.ColorizationColor.value, toHex(result.ColorizationColor.value))
    
        document.getElementById('AccentColor').style.backgroundColor = `#${toHex(result.AccentColor.value).substring(2)}`
        document.getElementById('ColorizationColor').style.backgroundColor = `#${toHex(result.ColorizationColor.value).substring(2)}`
        document.getElementById('getAccentColor').style.backgroundColor = `#${color}`
    })
}

@electron-triage
Copy link

Thank you for taking the time to report this issue and helping to make Electron better.

The version of Electron you reported this on has been superseded by newer releases.

If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.

I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.

Thanks in advance! Your help is appreciated.

@electron-triage electron-triage added the blocked/need-info ❌ Cannot proceed without more information label Feb 19, 2020
@electron-triage
Copy link

Thank you for your issue!

We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. I'm going to close this but don't hesitate to reach out if you have or find the answers we need, we'll be happy to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants