nend

Get windows 8/10 Taskbar color

15 posts in this topic

#1 ·  Posted (edited)

After a long search I found a few registry keys dat contains the color of the taskbar in windows 10.

It's handy for example if you want to make a window in the same color as the taskbar.

ConsoleWrite(_Get_taskbar_color()); It return AARRGGBB

Func _Get_taskbar_color()
    If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "ColorPrevalence") Then
        If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency") Then
            Return  "0xD9" & StringLeft(StringRight(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent", "AccentPalette"), 16), 6)
        Else
            Return "0xFF" & StringLeft(StringRight(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent", "AccentPalette"), 24), 6)
        EndIf
    Else
        If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency") Then
            Return "0xD9000000"
        Else
            Return "0xFF000000"
        EndIf
    EndIf
EndFunc

Edit:

This code doesn't seems to be working on Windows 8 only for Windows 10

Edited by nend
2 people like this

Share this post


Link to post
Share on other sites



16 minutes ago, S3cret91 said:

Nice work. What about previous windows versions?

This would be cool for my notifications udf, but a working version for win 7/8/10 would be great.

I also think it would by nice for your notification udf.

If it's build in it would look of the notifications are part of windows.

In previous version of windows almost all users use aeroglas, aeroglas is'nt one color, I don't think it's possible.

Share this post


Link to post
Share on other sites

Oh yeh right, aeroglass...

 

I just tested your function and the return value does not fit the actual taskbar color for me. I have the standart dark taskbar (never changed since win install) which matches black with transparency 0xD9 (217) but your function returns 0x002642 as color for me which is a dark blue.

Share this post


Link to post
Share on other sites
Just now, S3cret91 said:

Oh yeh right, aeroglass...

 

I just tested your function and the return value does not fit the actual taskbar color for me. I have the standart dark taskbar (never changed since win install) which matches black with transparency 0xD9 (217) but your function returns 0x002642 as color for me which is a dark blue.

I've only tested on windows 10, do you have windows 10?

I have assumed that windows 8 have the same settings.

 

The function I build return 0xAARRGGBB can you post the full return code?

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Yes, windows 10

1.png.c23c60c59ef99c2171eb1d31027b3ab0.p

The return value is correct according to what the function does, but seems like this registry setting doesnt always match the actual task color, for whatever reason.

Edited by S3cret91

Share this post


Link to post
Share on other sites

Can you change the taskbar color in windows and test it again?

I've tested on multiple pc but all have the taskbar color changed.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ok, works now. So if you go to the color settings in win 10 and activate colors for taskbar, start site, info-center... it works. If it is not activated the the default color is used which is 0xD9000000

Edited by S3cret91

Share this post


Link to post
Share on other sites
1 minute ago, S3cret91 said:

Ok, works now. So if you go to the color settings in win 10 and activate colors for taskbar, start site, info-center... it works. If it is not activated the the default color is used which is 0xD9000000

Ok I have to find the key when it's activated or not, or else it will not work in all casses.

I've you find the registery key before I find it please let me know.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

ConsoleWrite(_Get_taskbar_color()); It return AARRGGBB

Func _Get_taskbar_color()
    If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "ColorPrevalence") Then
        If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency") Then
            Return  "0xD9" & StringLeft(StringRight(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent", "AccentPalette"), 16), 6)
        Else
            Return "0xFF" & StringLeft(StringRight(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent", "AccentPalette"), 24), 6)
        EndIf
    Else
        If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency") Then
            Return "0xD9000000"
        Else
            Return "0xFF000000"
        EndIf   
    EndIf
EndFunc

Found it, here is the code.

Edited by nend

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Big thanks. I will do some tests on win 8 later and include it!

 

E: Me again. Installed some vm's with Win 8 and 8.1 and for both it does not work. I checked the 8.1 registry and it looks like non of the entries exists. I may do some research tomorrow, but do you have any tips on how to find the entries?

 

Nvm, found a way using regshot.

Edited by S3cret91

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

19 hours ago, S3cret91 said:

Big thanks. I will do some tests on win 8 later and include it!

 

E: Me again. Installed some vm's with Win 8 and 8.1 and for both it does not work. I checked the 8.1 registry and it looks like non of the entries exists. I may do some research tomorrow, but do you have any tips on how to find the entries?

 

Nvm, found a way using regshot.

 

I had hope it will worked on windows 8 as well.

I have no possibilitie to tested it for my self, I haven't got windows 8

I've have allready rewrote a program of my wich uses this function.

Please let me know if you find a solution for windows 8.

Edit:

I've looked in the stats of one of my program and windows 8 is'nt (allmost) used anymore.

These are the stats of total 39105X

W7  = 14361

W8  = 3487

W10 = 24744

I think over a year no one will use windows 8 anymore.

 

Edited by nend

Share this post


Link to post
Share on other sites

Guess so too. 

 

But I did some research: Win 8/8.1 has 2 different colors: taskbar and window border color. Reading out the border (and title) color of windows is easy:

Hex(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM", "ColorizationColor"), 8)

The taskbar color seems to be stored in a longer hex value, need to find out where the color is put.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

5 hours ago, S3cret91 said:

Guess so too. 

 

But I did some research: Win 8/8.1 has 2 different colors: taskbar and window border color. Reading out the border (and title) color of windows is easy:

Hex(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM", "ColorizationColor"), 8)

The taskbar color seems to be stored in a longer hex value, need to find out where the color is put.

Yeah I found it to.

In windows 10 this code give the highlight color of the taskbar, mabey it will give the correct taskbar color in win 8, can you test it?

#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>

If Not _WinAPI_DwmIsCompositionEnabled() Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later with enabled Aero theme.')
    Exit
EndIf

Local $iColor = _WinAPI_DwmGetColorizationColor()

ConsoleWrite('Color for glass composition: 0x' & Hex($iColor) & @CRLF)

 

Edited by nend

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now