Stay organized with collections
Save and categorize content based on your preferences.
Most Blockly apps use a variety of block colours to visually group the blocks
into categories. The blocks shipped with Blockly include several categories,
with the colours mirrored by the various toolbar categories in the demos:
Additional colours on the block are derived from the main colour. For example,
shadow blocks
are a desaturated version of the main colour, and border colours are a darker
version.
Set block colour
The primary colour of a block can be defined in either JSON or JavaScript. You
can pass the hue (preferred), RGB value, or color name; for more information,
see Colour formats.
JSON
{// ...,"colour":160,}
JavaScript
init:function(){// ...this.setColour(160);}
Note the British spelling. Failure to set the colour results in a black block.
You can also set the block color using the
Block.setColour(..)
function, or by using themes
and defining a block style.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-23 UTC."],[],[],null,["# Block colours\n\nMost Blockly apps use a variety of block colours to visually group the blocks\ninto categories. The blocks shipped with Blockly include several categories,\nwith the colours mirrored by the various toolbar categories in the demos:\n\nAdditional colours on the block are derived from the main colour. For example,\n[shadow blocks](/blockly/guides/configure/web/toolboxes/preset#shadow_blocks)\nare a desaturated version of the main colour, and border colours are a darker\nversion.\n| **Tip:** If you want more control over shadow block or border colours, learn about [defining a theme](/blockly/guides/configure/web/appearance/themes).\n\nSet block colour\n----------------\n\nThe primary colour of a block can be defined in either JSON or JavaScript. You\ncan pass the hue (preferred), RGB value, or color name; for more information,\nsee [Colour formats](/blockly/guides/configure/web/appearance/colour-formats). \n\n### JSON\n\n {\n // ...,\n \"colour\": 160,\n }\n\n### JavaScript\n\n init: function() {\n // ...\n this.setColour(160);\n }\n\nNote the British spelling. Failure to set the colour results in a black block.\n\nYou can also set the block color using the\n[`Block.setColour(..)`](/blockly/reference/js/blockly.block_class.setcolour_1_method)\nfunction, or by using [themes](/blockly/guides/configure/web/appearance/themes)\nand defining a block style.\n\nAccessibility\n-------------\n\nFor information about how colour affects accessibility, see [Colour and\naccessibility](/blockly/guides/configure/web/colour-a11y)"]]