/// <summary> /// Gets the color. /// </summary> /// <param name="immersiveColor">Color of the immersive.</param> /// <returns>Color.</returns> public static Color GetColor(ImmersiveColors immersiveColor) { //this.AccentColorResultTextBox, ImmersiveColors.ImmersiveStartSelectionBackground //this.MainColorResultTextBox, ImmersiveColors.ImmersiveStartPrimaryText //this.BackgroundColorResultTextBox,ImmersiveColors.ImmersiveStartBackground IntPtr pElementName = Marshal.StringToHGlobalUni(immersiveColor.ToString()); var colourset = StarScreenColorsHelper.GetImmersiveUserColorSetPreference(false, false); uint type = StarScreenColorsHelper.GetImmersiveColorTypeFromName(pElementName); Marshal.FreeCoTaskMem(pElementName); uint colourdword = StarScreenColorsHelper.GetImmersiveColorFromColorSetEx((uint)colourset, type, false, 0); byte[] colourbytes = new byte[4]; colourbytes[0] = (byte)((0xFF000000 & colourdword) >> 24); // A colourbytes[1] = (byte)((0x00FF0000 & colourdword) >> 16); // B colourbytes[2] = (byte)((0x0000FF00 & colourdword) >> 8); // G colourbytes[3] = (byte)(0x000000FF & colourdword); // R Color color = Color.FromArgb(colourbytes[0], colourbytes[3], colourbytes[2], colourbytes[1]); return color; }
public static Color Get(this ImmersiveColors immersiveColor) { IntPtr pElementName = Marshal.StringToHGlobalUni(immersiveColor.ToString()); var colourset = StarScreenColorsHelper.GetImmersiveUserColorSetPreference(false, false); uint type = StarScreenColorsHelper.GetImmersiveColorTypeFromName(pElementName); Marshal.FreeCoTaskMem(pElementName); uint colourdword = StarScreenColorsHelper.GetImmersiveColorFromColorSetEx((uint)colourset, type, false, 0); byte[] colourbytes = new byte[4]; colourbytes[0] = (byte)((0xFF000000 & colourdword) >> 24); // A colourbytes[1] = (byte)((0x00FF0000 & colourdword) >> 16); // B colourbytes[2] = (byte)((0x0000FF00 & colourdword) >> 8); // G colourbytes[3] = (byte)(0x000000FF & colourdword); // R Color color = Color.FromArgb(colourbytes[0], colourbytes[3], colourbytes[2], colourbytes[1]); return(color); }
/// <summary> /// Gets the color. /// https://github.com/RoliSoft/RS-TV-Show-Tracker/commit/54ce20e3b7299038874cf698bfb25ef2bfab9ed6 /// </summary> /// <param name="immersiveColor">Color of the immersive.</param> /// <returns>Color.</returns> private static Color GetColor(ImmersiveColors immersiveColor) { //this.AccentColorResultTextBox, ImmersiveColors.ImmersiveStartSelectionBackground //this.MainColorResultTextBox, ImmersiveColors.ImmersiveStartPrimaryText //this.BackgroundColorResultTextBox,ImmersiveColors.ImmersiveStartBackground IntPtr pElementName = Marshal.StringToHGlobalUni(immersiveColor.ToString()); var colourset = GetImmersiveUserColorSetPreference(false, false); uint type = GetImmersiveColorTypeFromName(pElementName); Marshal.FreeCoTaskMem(pElementName); uint colourdword = GetImmersiveColorFromColorSetEx((uint)colourset, type, false, 0); byte[] colourbytes = new byte[4]; colourbytes[0] = (byte)((0xFF000000 & colourdword) >> 24); // A colourbytes[1] = (byte)((0x00FF0000 & colourdword) >> 16); // B colourbytes[2] = (byte)((0x0000FF00 & colourdword) >> 8); // G colourbytes[3] = (byte)(0x000000FF & colourdword); // R Color color = Color.FromArgb(colourbytes[0], colourbytes[3], colourbytes[2], colourbytes[1]); return(color); }
/// <summary> /// Returns used-defined Immersive Colors of system /// </summary> /// <param name="color">Immersive Color</param> /// <returns>User-setted color</returns> public static Color GetImmersiveColor(ImmersiveColors color) { return GetMetroColorByString(color.ToString()); }
public static Color GetColor(ImmersiveColors color) { IntPtr pElementName = Marshal.StringToHGlobalUni(color.ToString()); return(GetColor(pElementName)); }
/// <summary> /// Returns used-defined Immersive Colors of system /// </summary> /// <param name="color">Immersive Color</param> /// <returns>User-setted color</returns> public static Color GetImmersiveColor(ImmersiveColors color) => GetMetroColorByString(color.ToString());
/// <summary> /// Returns used-defined Immersive Colors of system /// </summary> /// <param name="color">Immersive Color</param> /// <returns>User-setted color</returns> public static Color GetImmersiveColor(ImmersiveColors color) { return(GetMetroColorByString(color.ToString())); }