Hide Comments
Hide Comments

ParseColor(String,TSVGColor,Boolean,Boolean) Method

Comments (0)

Parses the input string for a color value.

The allowable values are color | inherit

Namespace: RSSVGUtils



 function ParseColor( S: String;
  DefValue: TSVGColor; var Clear: Boolean; var Inherits: Boolean ): TSVGColor;



Type: String


Type: System.Void


Type: Boolean


Type: Boolean

Return Value

Type: TSVGColor


If the string is blank, the function returns the default value ( DefValue). If the string contains 'inherits', the function returns the default value and sets the Inherits parameter to true.

A color is either a keyword or a numerical RGB specification. The format of an RGB value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display. The format of an RGB value in the functional notation is an RGB start-function followed by a comma-separated list of three numerical values (either three integer values or three percentage values) followed by ")". An RGB start-function is the case- insensitive string "rgb(", for example "RGB(" or " rGb(". For compatibility, the all-lowercase form "rgb(" is preferred. The integer value 255 corresponds to 100%, and to F or FF in the hexadecimal notation: rgb(255,255,255) = rgb(100%, 100%,100%) = # FFF. White space characters are allowed around the numerical values. All RGB colors are specified in the sRGB color space [ SRGB]. Using sRGB provides an unambiguous and objectively measurable definition of the color, which can be related to international standards (see [COLORIMETRY]).
color ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?
| "rgb(" wsp* integer comma integer comma integer wsp* ")"
| "rgb(" wsp* integer "%" comma integer "%" comma integer "% " wsp* ")"
| color-keyword
hexdigit ::= [0-9A-Fa-f]
comma ::= wsp* "," wsp*

expandingSee Also


Comments (0)

RiverSoftAVG SVG Component Library (RSCL) © 2013-2015, Thomas G. Grubb