public string Format() { if (_isDefault) { return(String.Empty); } StringBuilder bld = new StringBuilder(); for (int i = 0; i < _colors.Length; i++) { if (i > 0) { bld.Append(','); } ESColor color = _colors[i]; if (color.IsExactColor) { bld.Append('!'); } bld.Append(color.Color.Name); // Note: Color.Name returns hex'ed ARGB value if it was not a named color. } return(bld.ToString()); }
private Color GetESBackColor(int colorCode) { ESColor c = this.ESColorSet[colorCode]; if (this.DarkenEsColorForBackground && !c.IsExactColor) { return(DrawUtil.DarkColor(c.Color)); } return(c.Color); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is ESColor)) { return(false); } ESColor c = (ESColor)obj; return((_color.ToArgb() == c._color.ToArgb()) && (_isExactColor == c._isExactColor)); }
public void Load(string value) { if (!_isDefault) { ResetToDefault(); } if (value == null) { return; // use default colors } string[] cols = value.Split(','); int overrides = 0; for (int i = 0; i < cols.Length; i++) { string w = cols[i].Trim(); bool isExactColor; if (w.Length > 0 && w[0] == '!') { isExactColor = true; w = w.Substring(1); } else { isExactColor = false; } if (w.Length == 0) { continue; // use default color } Color color = ParseUtil.ParseColor(w, Color.Empty); if (!color.IsEmpty) { _colors[i] = new ESColor(color, isExactColor); overrides++; } } if (overrides > 0) { _isDefault = false; } }
private void OnOK(object sender, EventArgs args) { _backColor = _backColorBox.SelectedColor; _foreColor = _foreColorBox.SelectedColor; for (int i = 0; i < _colorBoxes.Length; i++) { Color c = _colorBoxes[i].SelectedColor; _esColorSet[i] = new ESColor(c, false); } }
public void Load(string value) { if (!_isDefault) ResetToDefault(); if (value == null) return; // use default colors string[] cols = value.Split(','); int overrides = 0; for (int i = 0; i < cols.Length; i++) { string w = cols[i].Trim(); bool isExactColor; if (w.Length > 0 && w[0] == '!') { isExactColor = true; w = w.Substring(1); } else { isExactColor = false; } if (w.Length == 0) continue; // use default color Color color = ParseUtil.ParseColor(w, Color.Empty); if (!color.IsEmpty) { _colors[i] = new ESColor(color, isExactColor); overrides++; } } if (overrides > 0) _isDefault = false; }