Stay organized with collections Save and categorize content based on your preferences.

blockly > FieldColour > (constructor)

FieldColour.(constructor)

Constructs a new instance of the FieldColour class

Signature:

constructor(opt_value?: string | Sentinel, opt_validator?: Function, opt_config?: FieldColourConfig);

Parameters

Parameter Type Description
opt_value string | Sentinel (Optional) The initial value of the field. Should be in '#rrggbb' format. Defaults to the first value in the default colour array. Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by subclasses that want to handle configuration and setting the field value after their own constructors have run).
opt_validator Function (Optional) A function that is called to validate changes to the field's value. Takes in a colour string & returns a validated colour string ('#rrggbb' format), or null to abort the change.Blockly.
opt_config FieldColourConfig (Optional) A map of options used to configure the field. See the [field creation documentation]https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/colour for a list of properties this parameter supports.