-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathColorDumper.cs
48 lines (40 loc) · 1.37 KB
/
ColorDumper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Runtime.InteropServices;
class ColorDumper
{
[DllImport("uxtheme.dll", EntryPoint = "#95")]
static extern uint GetImmersiveColorFromColorSetEx(uint dwImmersiveColorSet, uint dwImmersiveColorType, bool bIgnoreHighContrast, uint dwHighContrastCacheMode);
[DllImport("uxtheme.dll", EntryPoint = "#96", CharSet = CharSet.Unicode)]
static extern uint GetImmersiveColorTypeFromName(string name);
[DllImport("uxtheme.dll", EntryPoint = "#98")]
static extern uint GetImmersiveUserColorSetPreference(bool bForceCheckRegistry, bool bSkipCheckOnFail);
[DllImport("uxtheme.dll", EntryPoint = "#100")]
unsafe static extern char **GetImmersiveColorNamedTypeByIndex(uint dwIndex);
unsafe static int Main()
{
try
{
uint i = 0;
do
{
var typeNamePtr = GetImmersiveColorNamedTypeByIndex(i);
if (typeNamePtr != null)
{
var typeName = new string(*typeNamePtr);
var colorSet = GetImmersiveUserColorSetPreference(false, false);
var colorType = GetImmersiveColorTypeFromName("Immersive" + typeName);
var rawColor = GetImmersiveColorFromColorSetEx(colorSet, colorType, false, 0);
Console.WriteLine("{0} - {1:X}", typeName, rawColor);
}
} while (++i != 0);
return 0;
}
catch (Exception exc)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(exc);
Console.ResetColor();
return 1;
}
}
}