mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-03 17:14:27 -04:00
fix extension block color application
This commit is contained in:
parent
297047a6b9
commit
91f0d59be0
2 changed files with 16 additions and 3 deletions
|
@ -152,6 +152,10 @@ class SomeBlocks {
|
|||
// Will be used as the extension's namespace.
|
||||
id: 'someBlocks',
|
||||
|
||||
// Core extensions only: override the default extension block colors.
|
||||
color1: '#FF8C1A',
|
||||
color2: '#DB6E00',
|
||||
|
||||
// Optional: the human-readable name of this extension as string.
|
||||
// This and any other string to be displayed in the Scratch UI may either be
|
||||
// a string or a call to `formatMessage`; a plain string will not be
|
||||
|
|
|
@ -40,6 +40,8 @@ const defaultBlockPackages = {
|
|||
scratch3_procedures: require('../blocks/scratch3_procedures')
|
||||
};
|
||||
|
||||
const defaultExtensionColors = ['#0FBD8C', '#0DA57A', '#0B8E69'];
|
||||
|
||||
/**
|
||||
* Information used for converting Scratch argument types into scratch-blocks data.
|
||||
* @type {object.<ArgumentType, {shadowType: string, fieldType: string}>}
|
||||
|
@ -775,14 +777,21 @@ class Runtime extends EventEmitter {
|
|||
showStatusButton: extensionInfo.showStatusButton,
|
||||
blockIconURI: extensionInfo.blockIconURI,
|
||||
menuIconURI: extensionInfo.menuIconURI,
|
||||
color1: extensionInfo.colour || '#0FBD8C',
|
||||
color2: extensionInfo.colourSecondary || '#0DA57A',
|
||||
color3: extensionInfo.colourTertiary || '#0B8E69',
|
||||
customFieldTypes: {},
|
||||
blocks: [],
|
||||
menus: []
|
||||
};
|
||||
|
||||
if (extensionInfo.color1) {
|
||||
categoryInfo.color1 = extensionInfo.color1;
|
||||
categoryInfo.color2 = extensionInfo.color2;
|
||||
categoryInfo.color3 = extensionInfo.color3;
|
||||
} else {
|
||||
categoryInfo.color1 = defaultExtensionColors[0];
|
||||
categoryInfo.color2 = defaultExtensionColors[1];
|
||||
categoryInfo.color3 = defaultExtensionColors[2];
|
||||
}
|
||||
|
||||
this._blockInfo.push(categoryInfo);
|
||||
|
||||
this._fillExtensionCategory(categoryInfo, extensionInfo);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue