-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Set/change pen color blocks with color, brightness, saturation, transparency #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set/change pen color blocks with color, brightness, saturation, transparency #725
Conversation
And remove set/change color and shade blocks. All 4 params are now scaled 0-100.
For color (hue) in range 0-100, to get RGB (0, 0, 1), we need to use 100 * 2/3 = 66.66
Lint is failing
|
Note that we are hoping to do a workshop on Wednesday Oct 25th using this version on develop, so lets try to merge and deploy by then if possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me, and confirmed it plays nice with GUI (that PR mentioned in the description is already merged).
@cwillisf I think it is probably important for you to take a look at this also though.
@cwillisf please /cc me when this is ready so I know if we can use it on Wednesday for the workshop. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and is working well locally. Thanks @ericrosenbaum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code itself looks good (with one minor comment on naming or documentation) but I'm concerned about compatibility. It seems like this will break compatibility with pen projects from Scratch 2.0, especially with the change to the wrapping behavior. Is there a plan for that?
* @returns {number} the clamped value. | ||
* @private | ||
*/ | ||
_clampTransparency (value) { | ||
_clampColorParam (value) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Resolves
Resolves scratchfoundation/scratch-blocks#1091
Resolves scratchfoundation/scratch-gui#783
And progress on scratchfoundation/scratch-gui#725
Note that testing these changes will require pulling a PR on Scratch-gui that updates the extension library modal: scratchfoundation/scratch-gui#793
Proposed Changes
Change the way the pen color is set to use a menu of four color parameters: color, brightness, saturation and transparency. All are scaled 0-100. Color is wrapped, the rest are clamped.
Reason for Changes
The earlier version of pen color blocks used different blocks with different ranges for the color parameters (and the "shade" block combined saturation and brightness). This change simplifies the color parameters by putting them all into the same range. It also reduces the total number of pen blocks by putting the four parameters into a menu.