Drawing > Styles


Color and Font

Create Color (from RGB)

rgb-block

Creates a Color value from red, green, blue channels. Numbers must be between [0-255] inclusive.

Utils.getColorRGB([NUMBER], [NUMBER], [NUMBER])

Set Color

set-color-block

Sets the color used for filling shapes (does not apply to fonts). You can select the color using the color picker, drag in a color attribute or drag in any block that returns a color.

g.fillColor = [COLOR];

Set Font

set-font-block

Sets the font used in drawing text. You can pick the font directly or drag in a font attribute block.

g.setFont([FONT]);

Opacity

Set Opacity

set-opacity-block

Sets the opacity (alpha) used in drawing to the specified percentage. Number must be between [0-100] inclusive.

g.alpha = ([NUMBER]/100);

Stroke

Set Stroke Color

set-stroke-color-block

Sets the stroke color used when drawing shapes (does not apply to fonts). You can select the color using the color picker, drag in a color attribute or drag in any block that returns a color.

g.strokeColor = [COLOR];

Set Stroke Thickness

set-stroke-block

Sets the stroke thickness (width) used when drawing shapes. Set to 0 to disable.

g.strokeSize = [NUMBER];

Font Width

Get Width of Text for Current Font

get-font-width-block

Returns the width of the specified text using the current font. Useful for calculating text drawing positions. May only be used in a when drawing event.

g.font.font.getTextWidth([TEXT])

Get Width of Text for Specific Font

get-font-width-block

Returns the width of the specified text using the given font. Useful for calculating text drawing positions.

[FONT].font.getTextWidth([TEXT])

Font Height

Get Height for Current Font

get-font-height-block

Returns the height of text using the current font. Useful for calculating text drawing positions. May only be used in a when drawing event.

g.font.getHeight()

Get Height for Specific Font

get-font-height-block

Returns the height of text using the given font. Useful for calculating text drawing positions.

[FONT].getHeight()