How do you change the colour of a variable watcher?

Title is self explanatory.

You don't. They're orange because the Variables block category is orange.

I asked how to do it using a custom block.

I know what you're asking. Watchers aren't part of the action you control on stage; they're a debugging aid. If you want something that behaves like a watcher but looks different, draw it yourself!

I know, but it's for a big pack of custom blocks I'm making.

You cannot change the color of a variable watcher in Snap! without a JavaScript extension.

I know. But how do you do it with the Javascript extension?

[scratchblocks](JavaScript function \( [varName] [red] [green] [blue] \) @delInput @addInput \{ [/*See the code below*/] \} :: operators)[/scratchblocks]

const watcher = this.findVariableWatcher(varName);
const color = new Color(red, green, blue);
watcher.color = color;
//Somehow, the line below doesn't really work when uncommented.
//watcher.cellMorph.color = color;

How can I get the cellMorph recolouring to work?

I don't know

Sorry, I don't see the relevance. Can you explain it to me?

yes

I mean in Snap!.

it doesnt

Using custom blocks.

How do I make it happen using Javascript custom blocks?

You spelt "ask" wrong
BTW, can @helicoptur help?

If I had a solution, I would’ve posted it already.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.