blockly-samples
blockly-samples copied to clipboard
Can i use color slider for LED?
Hi guys I'm new to here and i'm not good at English.
I wanna choose LED color with color slider but i can't find the way to do that.
I found Scratch 3.0 has the function that i want but i don't know how to apply it to the blockly.
I found that there's no field_colour_slider.js in blockly/core/ so i paste it from scratch but it doesn't work. I hope someone helping me. thank you
Hello,
Blockly has a different API than the scratch project, so you will usually run into issues moving a field from one project to the other. The last time I tried to move the color slider field it was a pretty easy fix though! There is documentation on Blockly's custom fields API https://developers.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating that might be helpful to you.
If you could also provide the errors you're getting, or an example of how the field is misbehaving, someone here will probably be able to help you out more =)
Best! --Beka
On Thu, Sep 10, 2020 at 8:54 AM shycoded [email protected] wrote:
Hi guys I'm new to here. BTW I wanna choose LED color with color slider but i can't find the way to do that.
I found Scratch 3.0 has the function that i want but i don't know how to apply it to the blockly. [image: Untitled] https://user-images.githubusercontent.com/69042796/92757747-ff45e180-f3c8-11ea-833b-1e0f314a63d6.png
I found that there's no field_colour_slider.js in blockly/core/ so i paste it from scratch but it doesn't work. I hope someone helping me. thank you
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/blockly/issues/4265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCDDDD57L3TO6YB7SK5IQDSFDZCRANCNFSM4RFKHXZA .
I'm going to transfer this to blockly-samples and relabel it as a feature request for a scratch-style color field.
Yeah, the link that you gave me is really good document and it can help me but i'm not good at coding and it is little bit hard for me. I guess dropDownDiv is similar to slider right?
Hello, Blockly has a different API than the scratch project, so you will usually run into issues moving a field from one project to the other. The last time I tried to move the color slider field it was a pretty easy fix though! There is documentation on Blockly's custom fields API https://developers.google.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating that might be helpful to you. If you could also provide the errors you're getting, or an example of how the field is misbehaving, someone here will probably be able to help you out more =) Best! --Beka … On Thu, Sep 10, 2020 at 8:54 AM shycoded @.***> wrote: Hi guys I'm new to here. BTW I wanna choose LED color with color slider but i can't find the way to do that. I found Scratch 3.0 has the function that i want but i don't know how to apply it to the blockly. [image: Untitled] https://user-images.githubusercontent.com/69042796/92757747-ff45e180-f3c8-11ea-833b-1e0f314a63d6.png I found that there's no field_colour_slider.js in blockly/core/ so i paste it from scratch but it doesn't work. I hope someone helping me. thank you — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/blockly/issues/4265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCDDDD57L3TO6YB7SK5IQDSFDZCRANCNFSM4RFKHXZA .
Hii !! I wanted to work on this issue. If any one is not working on it please assign to me.
Hello! It's been 2 years since there has been any activity on this issue, but I'm interested in working on making a plugin for color slider fields.
I think, if desired, I can recreate the three hue/saturation/brightness sliders as demonstrated by Scratch.
I don't think I can recreate the eyedropper tool as-is. Even Scratch's eyedropper only supports taking color values from Scratch's stage, limiting its utility.
However, HTML has a built-in color input widget: <input type="color"/>
. When clicked, this widget pops up its own color selection dropdown menu. Different browsers provide different color editors in this dropdown (e.g. Chrome provides a hue slider and saturation/brightness field, Safari provides swatches), but they generally include an eyedropper option that supports taking colors from anywhere on the screen.
I propose building a plugin that adds a new field type called FieldColourSlider or "field_colour_slider" that, when clicked, displays a custom dropdown with the HSV sliders along with a button to activate the browser's built-in color editor.
Correction: there IS a standalone eyedropper feature that can sample anywhere on the screen, activated by JavaScript: https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper
However, it is only available in some browsers (desktop chrome/edge/opera) so I may try to use it but I'll still have to fall back to the browser color picker.
The Scratch colour slider is implemented here.