Setting default saturation and value

143 views
Skip to first unread message

rd

unread,
Dec 9, 2021, 5:53:20 PM12/9/21
to Blockly
Hello List,

Thanks for Blockly, it's wonderful!

I've been setting Blockly.HSV_SATURATION and Blockly.HSV_VALUE, as described at:


however this seems to have stopped working recently? 

I'm loading Blockly using: <script src="https://unpkg.com/blockly/blockly.min.js"></script>

Is there a new way to do this?

I see they're now internalConstants exported for "legacy reasons": 


There are no console errors, and Blockly.HSV_VALUE prints as the value it's been set to, but the colours of the blocks and in the toolbox don't reflect this.

Thanks in advance,
Rohan

Beka Westberg

unread,
Dec 10, 2021, 10:53:56 AM12/10/21
to blo...@googlegroups.com
Hi Rohan,

This seems like a pretty bad bug, would you be willing to file an issue in the core repository? I'm sure the team would really appreciate it =)

Best wishes,
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/b492b447-69a0-421f-b862-8990e948369en%40googlegroups.com.

rd

unread,
Dec 10, 2021, 6:17:19 PM12/10/21
to Blockly
> This seems like a pretty bad bug, would you be willing to file an issue in the core repository? I'm sure the team would really appreciate it =)


To be clear though, I'm not sure this is a bug though, I might be making a mistake!  I'm a beginner...

Thanks,
Rohan

Sketch

unread,
Dec 11, 2021, 1:24:57 PM12/11/21
to blo...@googlegroups.com
Hmmm I've noticed something simulair.
I fixed it by setting the HUE before injecting the workspace.
Maybe that helps?
 
- Luke 

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

rd

unread,
Dec 11, 2021, 3:53:09 PM12/11/21
to Blockly
Hello Luke,

Thanks, but I think I'm setting them beforehand.

As below for instance, which is a more minimal example that I should've made earlier!

Best,
Rohan

* * *

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">

    <script src="https://unpkg.com/blockly/blockly.min.js"></script>
  </head>
  <body>
  <div id="blocklyDiv" style="height: 480px; width: 600px;"></div>
  <xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
    <block type="logic_compare"></block>
    <block type="controls_repeat_ext"></block>
    <block type="math_number"></block>
    <block type="text"></block>
  </xml>
  <script>
    Blockly.HSV_SATURATION = 0.20;
    Blockly.HSV_VALUE = 0.95;
    var blk_workspace = Blockly.inject('blocklyDiv', {toolbox: document.getElementById('toolbox')});
  </script>
  </body>
</html>


Sketch

unread,
Dec 15, 2021, 2:46:24 PM12/15/21
to blo...@googlegroups.com
Hmmm.
I am quessing it's a bug then like Beka said.

- Luke

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

Abby Schmiedt

unread,
Dec 15, 2021, 2:54:49 PM12/15/21
to Blockly
Hello!

This was a bug and we have put in a fix for it that we are planning on releasing a patch for later today. 

Here is the original issue and the fix.

Cheers, 
Abby

feni...@google.com

unread,
Dec 15, 2021, 4:27:48 PM12/15/21
to Blockly
And a more general note: we may continue to have similar problems as we modernize and modularize the codebase. Please continue to tell us if we made a property that you were using disappear without a good replacement or other deprecation warning, so that we can fix it or give you a workaround.

Cheers,
Rachel 

rd

unread,
Dec 15, 2021, 5:46:59 PM12/15/21
to Blockly
Thanks very kindly for the fix! So quick. It's working again perfectly. Best, Rohan

rd

unread,
Jul 3, 2023, 6:58:04 AM7/3/23
to Blockly
Hello all,

Revisiting this thread since Blockly.HSV_SATURATION and Blockly.HSV_VALUE seem not to work anymore with blockly-10.0.0?

Searching in the current blockly directory (i.e. current https://github.com/google/blockly) I can only find the entries in the CHANGELOG where they were added back in.

I wonder what is the new way to set these values?

Thanks in advance,
Rohan

Christopher Allen

unread,
Jul 4, 2023, 12:04:00 PM7/4/23
to blo...@googlegroups.com
Hi Rohan,

Revisiting this thread since Blockly.HSV_SATURATION and Blockly.HSV_VALUE seem not to work anymore with blockly-10.0.0?

Thanks for bringing this to our attention.  These were notionally deprecated quite a long time ago, but it seems we never actually marked them as `@deprecated`, nor added deprecation warnings as we usually would, so I have proposed that we at least temporarily restore them.

I wonder what is the new way to set these values?

You should use Blockly.colour.setHsvSaturation() and Blockly.colour.setHsvValue() respectively (and you should do so even if the aforementioned PR is approved and included in a patch release).

Apologies for this oversight on our part.


Christopher Allen

rd

unread,
Jul 4, 2023, 9:43:57 PM7/4/23
to Blockly
Hello Christopher,

Thanks very kindly for quick reply, these work perfectly!

(Though I did have to access them via utils, i.e. Blockly.utils.colour.setHsvSaturation() &etc.)

Happy holidays,
Rohan
Reply all
Reply to author
Forward
0 new messages