Vista/7: How to get glass color?

Posted by Ian Boyd on Stack Overflow See other posts from Stack Overflow or by Ian Boyd
Published on 2010-08-24T20:47:41Z Indexed on 2011/01/05 15:54 UTC
Read the original article Hit count: 357

Filed under:
|
|
|
|

How do you use DwmGetColorizationColor?

The documentation says it returns two values:

  • a 32-bit 0xAARRGGBB containing the color used for glass composition
  • a boolean parameter that is true "if the color is an opaque blend" (whatever that means)

Here's a color that i like, a nice puke green: alt text

You can notice the color is greeny, and the translucent title bar (against a white background) shows the snot color very clearly: alt text

i try to get the color from Windows:

DwmGetColorizationColor(dwCcolorization, bIsOpaqueBlend);

And i get

dwColorization: 0x0D0A0F04
bIsOpaqueBlend: false

According to the documentation this value is of the format AARRGGBB, and so contains:

AA: 0x0D (13)
RR: 0x0A (10)
GG: 0x0F (15)
BB: 0x04 (4)

This supposedly means that the color is (10, 15, 4), with an opacity of ~5.1%.

But if you actually look at this RGB value, it's nowhere near my desired snot green. Here is

  • (10, 15, 4) with zero opacity (the original color), and
  • (10,15,4) with 5% opacity against a white/checkerboard background:

alt text

So the question is: How to get glass color in Windows Vista/7?

i tried using DwmGetColorizationColor, but that doesn't work very well.


A person with same problem, but a nicer shiny picture to attract you squirrels: alt text

So, it boils down to – DwmGetColorizationColor is completely unusable for applications attempting to apply the current color onto an opaque surface.


i love this guy's screenshots much better than mine. Using his screenshots as a template, i made up a few more sparklies:

alt text

alt text

alt text

alt text

alt text

alt text

For the last two screenshots, the alpha blended chip is a true partially transparent PNG, blending to your browser's background. Cool! (i'm such a geek)

Edit 2: Had to arrange them in rainbow color. (i'm such a geek)

Edit 3: Well now i of course have to add Yellow.


Undocumented/Unsupported/Fragile Workarounds

There is an undocumented export from DwmApi.dll at entry point 137, which we'll call DwmGetColorizationParameters:

HRESULT GetColorizationParameters_Undocumented(out DWMCOLORIZATIONPARAMS params);

struct DWMCOLORIZATIONPARAMS
{
   public UInt32 ColorizationColor;
   public UInt32 ColorizationAfterglow;
   public UInt32 ColorizationColorBalance;
   public UInt32 ColorizationAfterglowBalance;
   public UInt32 ColorizationBlurBalance;
   public UInt32 ColorizationGlassReflectionIntensity;
   public UInt32 ColorizationOpaqueBlend;
}

We're interested in the first parameter: ColorizationColor.

We can also read the value out of the registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM
    ColorizationColor: REG_DWORD = 0x6614A600

So you pick your poison of creating appcompat issues. You can

See also


i've been wanting to ask this question for over a year now. i always knew that it's impossible to answer, and that the only way to get anyone to actually pay attention is to have colorful screenshots; developers are attracted to shiny things. But on the downside it means i had to put all kinds of work into making the lures.

© Stack Overflow or respective owner

Related posts about winapi

Related posts about aero