internal static Color Lookup(string name)
        {
            var colorSet  = Uxtheme.GetImmersiveUserColorSetPreference(false, false);
            var colorType = Uxtheme.GetImmersiveColorTypeFromName(name);
            var rawColor  = Uxtheme.GetImmersiveColorFromColorSetEx(colorSet, colorType, false, 0);

            return(rawColor.ToABGRColor());
        }
Пример #2
0
        public static bool TryLookup(string name, out Color color)
        {
            color = default(Color);

            var colorSet  = Uxtheme.GetImmersiveUserColorSetPreference(false, false);
            var colorType = Uxtheme.GetImmersiveColorTypeFromName(name);
            var rawColor  = Uxtheme.GetImmersiveColorFromColorSetEx(colorSet, colorType, false, 0);

            color = rawColor.ToABGRColor();
            return(rawColor != 4294902015);
        }
        internal static IDictionary <string, Color> GetList()
        {
            var colors   = new Dictionary <string, Color>();
            var colorSet = Uxtheme.GetImmersiveUserColorSetPreference(false, false);

            for (uint i = 0; ; i++)
            {
                var ptr = Uxtheme.GetImmersiveColorNamedTypeByIndex(i);
                if (ptr == IntPtr.Zero)
                {
                    break;
                }

                var name = Marshal.PtrToStringUni(Marshal.ReadIntPtr(ptr));
                colors.Add(name, Lookup($"Immersive{name}"));
            }

            return(colors);
        }