SharpVectors.Dom.Css.CssPrimitiveValue.GetRgbColorValue C# (CSharp) Method

GetRgbColorValue() public method

This method is used to get the RGB color. If this CSS value doesn't contain a RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface.
INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a rgb value.
public GetRgbColorValue ( ) : SharpVectors.Dom.Css.IRgbColor
return SharpVectors.Dom.Css.IRgbColor
        public virtual SharpVectors.Dom.Css.IRgbColor GetRgbColorValue()
        {
            if(PrimitiveType == CssPrimitiveType.RgbColor) return colorValue;
            else throw new DomException(DomExceptionType.InvalidAccessErr);
        }

Usage Example

 public void TestAbsoluteRgb()
 {
     color = new CssPrimitiveRgbValue("rgb( 100  ,	123,15)", false);
             RgbColor rgbColor = (RgbColor)color.GetRgbColorValue();
             Assert.AreEqual(100, rgbColor.Red.GetFloatValue(CssPrimitiveType.Number));
             Assert.AreEqual(123, rgbColor.Green.GetFloatValue(CssPrimitiveType.Number));
             Assert.AreEqual(15, rgbColor.Blue.GetFloatValue(CssPrimitiveType.Number));
 }
All Usage Examples Of SharpVectors.Dom.Css.CssPrimitiveValue::GetRgbColorValue