BackgroundColor < Element

Setting the BackgroundColor can be done in one of several ways. There’s setting a string value that can be a hexadecimal value, css rgb value or color alias, or it can be a Color object or finally a Colors alias. The string hexadecimal value is represented as #rrggbb where rr is the red component, gg is the green component and bb is the blue component. Using a string rgb css value consists of the string “rgb(r, b, g); where r, g and b are the red, blue and green components respectively. Using the Colors enumeration shows a preset supported list of colors defined by the W3 standards. Finally, using a Color object is valid as well.  Here is an example using all possible methods.

var div = $Div("myDiv");
div.BackgroundColor("navy");
div.BackgroundColor("#FFEC9A");
div.BackgroundColor("rgb(200, 123, 4)");
div.BackgroundColor(Colors.White);
div.BackgroundColor(new Color(23, 44, 123));

ForegroundColor and Style

The ForegroundColor works the exact same way in accept colors as the BackgroundColor. Any style that can use a color value will also accept color objects or alias.

Last edited Mar 27, 2011 at 3:27 PM by dahrkdaiz, version 4

Comments

No comments yet.