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

blockly > FieldColour > (constructor)


Constructs a new instance of the FieldColour class


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


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] for a list of properties this parameter supports.