private System.Drawing.Color GetColor(ColorKey colorKey) { #if DEBUG_COLOR_STYLE_OPTIONS Debug.WriteLine($"GeneralOptions.GetColor keyName={colorKey.Name}" + (colorKey.IsForeground? "FG":"BG") + $" color={colorMap[colorKey].Color}"); #endif return(colorMap[colorKey].Color); }
private void SetColor(bool sendNotification, string propertyName, ColorKey colorKey, System.Drawing.Color value) { #if DEBUG_COLOR_STYLE_OPTIONS Debug.WriteLine($"GeneralOptions.SetColor keyName={colorKey.Name}" + (colorKey.IsForeground? "FG":"BG") + $" color={value} Notify={sendNotification}"); #endif colorMap[colorKey].Color = value; if (sendNotification) { VsSettings.NotiifyInstancesFmtPropertyChanged(propertyName, fromDrawingColor(value)); } }
private static void SaveColor(IVsFontAndColorStorage vsStorage, ColorKey colorKey, System.Drawing.Color color) { Debug.WriteLine($"GeneralOptions.SaveColoR keyName={colorKey.Name} color={color}"); ThreadHelper.ThrowIfNotOnUIThread(); ColorableItemInfo[] arr = new ColorableItemInfo[1]; ErrorHandler.ThrowOnFailure(vsStorage.GetItem(colorKey.Name, arr)); if (colorKey.IsForeground) { arr[0].bForegroundValid = 1; arr[0].crForeground = (uint)ColorTranslator.ToWin32(color); } else { arr[0].bBackgroundValid = 1; arr[0].crBackground = (uint)ColorTranslator.ToWin32(color); } ErrorHandler.ThrowOnFailure(vsStorage.SetItem(colorKey.Name, arr)); }
private static System.Drawing.Color LoadColor(IServiceProvider Site, IVsFontAndColorStorage vsStorage, ColorKey colorKey) { ThreadHelper.ThrowIfNotOnUIThread(); var arr = new ColorableItemInfo[1]; ErrorHandler.ThrowOnFailure(vsStorage.GetItem(colorKey.Name, arr)); var isValid = colorKey.IsForeground ? arr[0].bForegroundValid : arr[0].bBackgroundValid; if (isValid == 0) { throw new Exception(); } var colorRef = colorKey.IsForeground ? arr[0].crForeground : arr[0].crBackground; var color = FromColorRef(Site, vsStorage, colorRef); Debug.WriteLine($"GeneralOptions.LoadColoR keyName={colorKey.Name} color={color}"); return(color); }
internal ColorInfo(ColorKey colorKey, System.Drawing.Color color, bool isValid = true) { ColorKey = colorKey; OriginalColor = color; Color = color; IsValid = isValid; }