internal ExcelDrawingThemeColorManager(XmlNamespaceManager nameSpaceManager, XmlNode topNode, string path, string[] schemaNodeOrder, Action initMethod = null) { _nameSpaceManager = nameSpaceManager; _topNode = topNode; _path = path; _initMethod = initMethod; _pathNode = GetPathNode(); _schemaNodeOrder = schemaNodeOrder; if (_pathNode == null) { return; } if (IsTopNodeColorNode(_topNode)) { _colorNode = _pathNode; } else { _colorNode = _pathNode.FirstChild; } if (_colorNode == null) { return; } switch (_colorNode.LocalName) { case "sysClr": ColorType = eDrawingColorType.System; SystemColor = new ExcelDrawingSystemColor(_nameSpaceManager, _pathNode.FirstChild); break; case "scrgbClr": ColorType = eDrawingColorType.RgbPercentage; RgbPercentageColor = new ExcelDrawingRgbPercentageColor(_nameSpaceManager, _pathNode.FirstChild); break; case "hslClr": ColorType = eDrawingColorType.Hsl; HslColor = new ExcelDrawingHslColor(_nameSpaceManager, _pathNode.FirstChild); break; case "prstClr": ColorType = eDrawingColorType.Preset; PresetColor = new ExcelDrawingPresetColor(_nameSpaceManager, _pathNode.FirstChild); break; case "srgbClr": ColorType = eDrawingColorType.Rgb; RgbColor = new ExcelDrawingRgbColor(_nameSpaceManager, _pathNode.FirstChild); break; default: ColorType = eDrawingColorType.None; break; } }
/// <summary> /// Sets a hsl color /// </summary> /// <param name="hue">The hue angle. From 0-360</param> /// <param name="saturation">The saturation percentage. From 0-100</param> /// <param name="luminance">The luminance percentage. From 0-100</param> public void SetHslColor(double hue, double saturation, double luminance) { ColorType = eDrawingColorType.Hsl; ResetColors(ExcelDrawingHslColor.NodeName); HslColor = new ExcelDrawingHslColor(_nameSpaceManager, _colorNode) { Hue = hue, Saturation = saturation, Luminance = luminance }; }