Class: Theme

Constructor

Theme

new Theme(name, blockStyles, categoryStyles, opt_componentStyles)

Class for a theme.

Parameter

name

string

Theme name.

blockStyles

Object with Blockly.Theme.BlockStyle properties

A map from style names (strings) to objects with style attributes for blocks.

Value must not be null.

categoryStyles

Object with Blockly.Theme.CategoryStyle properties

A map from style names (strings) to objects with style attributes for categories.

Value must not be null.

opt_componentStyles

Optional

Object with any type properties

A map of Blockly component names to style value.

Value must not be null.

Properties

blockStyles

package

non-null Object with non-null Blockly.Theme.BlockStyle properties

The block styles map.

categoryStyles

package

non-null Object with Blockly.Theme.CategoryStyle properties

The category styles map.

name

package

string

The theme name. This can be used to reference a specific theme in CSS.

Methods

getComponentStyle

getComponentStyle(componentName) returns string

Gets the style for a given Blockly UI component. If the style value is a string, we attempt to find the value of any named references.

Parameter

componentName

string

The name of the component.

Returns

nullable string The style value.

setComponentStyle

setComponentStyle(componentName, styleValue)

Configure a specific Blockly UI component with a style value.

Parameter

componentName

string

The name of the component.

styleValue

any type

The style value.

Abstract types

BlockStyle

static

{colourPrimary:string, colourSecondary:string, colourTertiary:string, hat:string}

A block style.

CategoryStyle

static

{colour:string}

A category style.