/// <summary> /// The add color to recent colors if missing. /// </summary> /// <param name="color"> /// The color. /// </param> /// <returns> /// True if the color was added. /// </returns> private bool AddColorToRecentColorsIfMissing(Color color) { // Check if the color exists if (ThemeColors.Contains(color)) { return(false); } if (StandardColors.Contains(color)) { return(false); } if (RecentColors.Contains(color)) { return(false); } if (RecentColors.Count >= this.MaxNumberOfRecentColors) { RecentColors.RemoveAt(RecentColors.Count - 1); } RecentColors.Insert(0, color); return(true); }
private void FillStandardColorsList() { StandardColors.Add(new SolidColorBrush(Colors.DarkRed)); StandardColors.Add(new SolidColorBrush(Colors.Red)); StandardColors.Add(new SolidColorBrush(Colors.Orange)); StandardColors.Add(new SolidColorBrush(Colors.Yellow)); StandardColors.Add(new SolidColorBrush(Colors.LightGreen)); StandardColors.Add(new SolidColorBrush(Colors.ForestGreen)); StandardColors.Add(new SolidColorBrush(Colors.LightSkyBlue)); StandardColors.Add(new SolidColorBrush(Colors.RoyalBlue)); StandardColors.Add(new SolidColorBrush(Colors.DarkSlateBlue)); StandardColors.Add(new SolidColorBrush(Colors.BlueViolet)); }
public NamedColor this[Color color] { get { var namedColor = ThemeColors.FirstOrDefault(c => c.Color == color) ?? StandardColors.FirstOrDefault(c => c.Color == color); if (namedColor == null && AutomaticColor.Color == color) { namedColor = AutomaticColor; } return(namedColor); } }
public string GetColorHexByExpression(StandardColors colors) { string hexString = colors switch { StandardColors.Red => "FF0000", StandardColors.Orange => "FFA500", StandardColors.Yellow => "FFFF00", StandardColors.Green => "008000", StandardColors.Blue => "0000FF", StandardColors.Black => "FFFFFF", StandardColors.White => "000000", _ => "000000", }; return(hexString); }
public string GetColorHex(StandardColors colors) { string hexString = string.Empty; switch (colors) { case StandardColors.Red: hexString = "FF0000"; break; case StandardColors.Orange: hexString = "FFA500"; break; case StandardColors.Yellow: hexString = "FFFF00"; break; case StandardColors.Green: hexString = "008000"; break; case StandardColors.Blue: hexString = "0000FF"; break; case StandardColors.Black: hexString = "FFFFFF"; break; case StandardColors.White: hexString = "000000"; break; default: hexString = "000000"; break; } return(hexString); }