This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
SVG_Define_solidColor

SVG_Define_solidColor 


 

SVG_Define_solidColor ( parentSVGObject ; id ; color {; opacity} ) -> Function result 
Parameter Type   Description
parentSVGObject  SVG_Ref in Reference of parent element
id  String in Color name
color  String in Color expression
opacity  Longint in Opacity
Function result  SVG_Ref in Color reference

The SVG_Define_solidColor command sets a new custom color in the SVG container designated by parentSVGObject and returns its reference. If parentSVGObject is not an SVG document, an error is generated.

The id parameter specifies the color name. The name will be used to associate a color with an object. If an element with the same name exists, it will be replaced.

The color parameter is a color expression recognized by SVG (see Colors and Gradients).

The optional opacity parameter can be used to specify an opacity (from 0 to 100) for this color. If the parameter is omitted, the opacity will be 100%.

The color set in this way will be associated with the fill or stroke paint by passing the string "url(#ID)" as the value when a color expression is expected.

Example  

  `Set blue to 50%
 SVG_Define_solidColor($svg;"MyColor";"blue";50)
 ...
 SVG_New_rect($svg;0;0;20;20;0;0;"url(#MyColor)";"url(#MyColor)")
 ...
 $line:=SVG_New_line(10;10;100;100)
 SVG_SET_STROKE_BRUSH($line;"url(#MyColor)")



See also 

SVG Colors

 
PROPERTIES 

Product: 4D
Theme: Structure and Definitions
Number: 65989

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: Composant 4D SVG v11.3

 
ARTICLE USAGE

4D SVG Component ( 4D v20 R7)