Vista/7: How to get glass color?

Ian*_*oyd 53 winapi aero dwm user-preferences

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: 替代文字

You can notice the color is greeny, and the translucent title bar (against a white background) shows the snot color very clearly: 在此输入图像描述

i try to get the color from Windows:

DwmGetColorizationColor(dwCcolorization, bIsOpaqueBlend);
Run Code Online (Sandbox Code Playgroud)

And i get

dwColorization: 0x0D0A0F04
bIsOpaqueBlend: false
Run Code Online (Sandbox Code Playgroud)

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)
Run Code Online (Sandbox Code Playgroud)

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:

替代文字

Rather than being Lime green, DwmGetColorizationColor returns an almost fully transparent black.

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: 替代文字

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:

替代文字

替代文字

替代文字

替代文字

替代文字

替代文字

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;
}
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

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

See also


我一直想问这个问题超过一年了.我一直都知道这是不可能回答的,让人们真正关注的唯一方法就是拥有丰富多彩的截图; 开发人员被闪亮的东西所吸引.但在不利方面,这意味着我必须把各种各样的工作放到诱饵上.

Raf*_*era 10

着色颜色!=选择的基色.我知道,这是误导.

但我很困惑.您借来的图片来自我的帖子" 为不透明表面渲染检索航空玻璃基色 ".这不是你想做的吗?我还在帖子中指出了存储所有颜色信息的注册表位置(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM)以供检索.

编辑8/26

DwmGetColorizationColor(dwmapi.dll)返回"着色颜色",它是各种颜色(包括您选择的基色)和着色器逻辑的混合,以实现整体玻璃效果.

您需要/想要的所有颜色信息都可以在上面提到的注册表项中找到.基色,混合中使用的颜色以及由此产生的着色颜色都在那里.

(上面的密钥出现在Windows Vista及更高版本上.)

  • @Rafael Rivera这是一个鸡与蛋的问题.Microsoft无法更改其内部实现细节,因为编写得不好的程序取决于实现细节.因此,微软必须为这些设计糟糕的程序创建兼容性垫片.人们争辩说微软应该继续打破破坏规则的应用程序; 但是微软不能这样做,因为那时"Windows 8打破了我的应用程序",而不是准确的"我的应用程序总是被打破,而且它的功能令人惊讶." http://blogs.msdn.com/b/oldnewthing/archive/2003/12/24/45779.aspx (4认同)
  • 它*是*我想做的.但是和你一样,我想避免依赖未记录的函数或注册表项.我希望有人可以破译`DwmGetColorizationColor`返回的内容.或者解释如何将其变成与用户选择的内容相关的内容. (2认同)

Mch*_*chl 1

您觉得 A0F040 怎么样?


OP 编辑​​:这就是 0xA0F040 对我来说的样子:

替代文本