Ümit Dönmez schrieb am Dienstag, 27. Juli 2021 um 17:32:35 UTC+2:
Hi there,
I can't get my custom theme running.
I have the injection in my ngOnInit() like here where I say to use my custom theme.
ngOnInit(): void {
this.workspace = Blockly.inject('blocklyDiv',
{
toolbox: document.getElementById('toolbox'),
zoom:
{
controls: true,
wheel: true
},
grid:
{
spacing: 25,
length: 3,
colour: '#ccc',
snap: true,
},
renderer: 'zelos',
theme: 'custom'
});
And my custom theme is in node_modules/blockly/core/theme/custom.js
'use strict';
goog.provide('Blockly.Themes.Custom');
goog.require('Blockly.Theme');
Blockly.Themes.Custom = Blockly.Theme.defineTheme('custom', {
'base': Blockly.Themes.Classic,
'fontStyle': {
"family": "Arial",
"weight": "bold",
"size": 12,
},
'blockStyles': {
'logic_blocks': {
"colourPrimary": "#7ab1f5",
"colourSecondary": "#A9C5EB",
"colourTertiary": "#d7e4f3"
},
'loop_blocks': {
"colourPrimary": "#5EAE9E",
"colourSecondary": "#8DC7BB",
"colourTertiary": "#CFE7E2"
},
'math_blocks': {
"colourPrimary": "#E994AB",
"colourSecondary": "#F0B9C8",
"colourTertiary": "#FAE7EC"
},
'text_blocks': {
"colourPrimary": "#8282FF",
"colourSecondary": "#B7B7FF",
"colourTertiary": "#DBDBFF"
},
'variable_blocks': {
"colourPrimary": "#d3ab9e",
"colourSecondary": "#d6c2bc",
"colourTertiary": "#d4ccc9"
},
'procedure_blocks': {
"colourPrimary": "#b8b5b5",
"colourSecondary": "#d6d2d2",
"colourTertiary": "#d6d2d2"
},
'motion_blocks': {
"colourPrimary": "#5ad0e2",
"colourSecondary": "#7de1ef",
"colourTertiary": "#a3e7ef",
}
},
'categoryStyles': {
"logic_category": {
"colour": "#7ab1f5",
},
"loop_category": {
"colour": "#5EAE9E",
},
"math_category": {
"colour": "#E994AB",
},
"text_category": {
"colour": "#8282FF",
},
"variable_category": {
"colour": "#d3ab9e",
},
"function_category": {
"colour": "#d6d2d2",
},
"motion_category": {
"colour": "#bde0fe",
}
},
'componentStyles': {
'workspaceBackgroundColour': '#e9e9e9',
'toolboxBackgroundColour': '#3e3e3e',
'toolboxForegroundColour': '#fff',
'flyoutBackgroundColour': '#303030',
'flyoutForegroundColour': '#ccc',
'flyoutOpacity': .8,
'scrollbarColour': '#797979',
'scrollbarOpacity': 0.4
}
});
What do I need to do that the theme can work.
If I set the them in the injection to anything else like dark or classic or the others it works.
Do I need to register my custom theme anywhere?