How to obtain the system accent colour on Windows?
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
How to obtain the system accent colour on Windows?
Hi there,
I am looking for a way to obtain the system accent colour on Windows 10/11 (i.e. the colour that can change based on the desktop wallpaper).
Is this possible?
Kind regards,
Francis
I am looking for a way to obtain the system accent colour on Windows 10/11 (i.e. the colour that can change based on the desktop wallpaper).
Is this possible?
Kind regards,
Francis
Re: How to obtain the system accent colour on Windows?
Hi
Use registry
In my case it's $ffd77800
OR
Use registry
In my case it's $ffd77800
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent]
"AccentPalette"=hex:9a,eb,ff,00,61,cc,ff,00,00,93,fc,00,00,78,d7,00,00,5f,ba,\
00,00,3f,95,00,00,1a,6a,00,88,17,98,00
"StartColorMenu"=dword:ffba5f00
"AccentColorMenu"=dword:ffd77800
Code: Select all
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"Composition"=dword:00000001
"ColorizationColor"=dword:c40078d7
"ColorizationColorBalance"=dword:00000059
"ColorizationAfterglow"=dword:c40078d7
"ColorizationAfterglowBalance"=dword:0000000a
"ColorizationBlurBalance"=dword:00000001
"EnableWindowColorization"=dword:00000000
"ColorizationGlassAttribute"=dword:00000001
"AccentColor"=dword:ffd77800
"ColorPrevalence"=dword:00000000
"EnableAeroPeek"=dword:00000001
"AlwaysHibernateThumbnails"=dword:00000000
Egypt my love
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: How to obtain the system accent colour on Windows?
Thanks RASHAD!
Kind regards,
Francis
Kind regards,
Francis
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: How to obtain the system accent colour on Windows?
I've utilised Thomas "ts-soft" Schulz's registry code (viewtopic.php?t=56204) to create a quick example of obtaining Windows' system accent colour:
Kind regards,
Francis
Code: Select all
XIncludeFile "Registry.pbi"
UseModule Registry
Procedure.l GetSystemAccentColor()
ProcedureReturn Val(ReadValue(#HKEY_CURRENT_USER, "Software\Microsoft\Windows\DWM", "AccentColor"))
EndProcedure
Debug "System accent colour: $" + Hex(GetSystemAccentColor(), #PB_Long)
Francis
Re: How to obtain the system accent colour on Windows?
Code: Select all
Debug "System accent colour: $" + Hex(GetSystemAccentColor(), #PB_Long)
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: How to obtain the system accent colour on Windows?
It's an RGBA value, so the initial $FF value is the alpha channel.
Kind regards,
Francis
Kind regards,
Francis
Re: How to obtain the system accent colour on Windows?
Thanks for the explanation. So if we don't use the alpha channel, we can remove the leading $FF bit?
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: How to obtain the system accent colour on Windows?
Yes, you could do something like this:
Kind regards,
Francis
Code: Select all
RGB = GetSystemAccentColor() & $FFFFFF
Debug "System accent colour: $" + Hex(RGB, #PB_Long)
Francis
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: How to obtain the system accent colour on Windows?
I've expanded the example to include the other palette information.
On my system, this produces the RGB/RGBA values for the following palette:
▮▮▮▮▮▮▮▮▮▮
Kind regards,
Francis
Code: Select all
XIncludeFile "Registry.pbi"
UseModule Registry
Structure Palette
RGB.l[8]
EndStructure
Procedure.l GetSystemAccentColor()
ProcedureReturn Val(ReadValue(#HKEY_CURRENT_USER,
"Software\Microsoft\Windows\CurrentVersion\Explorer\Accent",
"AccentColorMenu"))
EndProcedure
Procedure.l GetSystemStartColorMenu()
ProcedureReturn Val(ReadValue(#HKEY_CURRENT_USER,
"Software\Microsoft\Windows\CurrentVersion\Explorer\Accent",
"StartColorMenu"))
EndProcedure
Procedure.s GetSystemAccentPalette(*AccentPalette.Palette)
Result$ = ReadValue(#HKEY_CURRENT_USER,
"Software\Microsoft\Windows\CurrentVersion\Explorer\Accent",
"AccentPalette")
For i = 0 To 7
Index = i * 4 + 1
r = Val(StringField(Result$, Index, ","))
g = Val(StringField(Result$, Index + 1, ","))
b = Val(StringField(Result$, Index + 2, ","))
*AccentPalette\RGB[i] = RGB(r, g, b)
Next
EndProcedure
Debug "System accent colour: $" + Hex(GetSystemAccentColor(), #PB_Long)
Debug "System start colour menu: $" + Hex(GetSystemStartColorMenu(), #PB_Long)
AccentPalette.Palette
GetSystemAccentPalette(@AccentPalette)
For i = 0 To 7
Debug "System accent palette colour " + Str(i) + " = $" + Hex(AccentPalette\RGB[i])
Next
▮▮▮▮▮▮▮▮▮▮
Kind regards,
Francis
Re: How to obtain the system accent colour on Windows?
Thanks Francis
You saved me time for coding
You saved me time for coding
Egypt my love
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: How to obtain the system accent colour on Windows?
You're welcome RASHAD.
I'm not sure what each of the colours in the accent palette are for, but there they are. I haven't figured out how to work the AccentColorLight1-3 and AccentColorDark1-3 colors though. Seems this might be done on the fly and no one but Microsoft knows the algorithm.
Kind regards,
Francis
I'm not sure what each of the colours in the accent palette are for, but there they are. I haven't figured out how to work the AccentColorLight1-3 and AccentColorDark1-3 colors though. Seems this might be done on the fly and no one but Microsoft knows the algorithm.
Kind regards,
Francis