Discuss Scratch
- Discussion Forums
- » Suggestions
- » Pen Improvement - Colors as Hexadecimal Entities.
- theonlygusti
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
I think that pen colors should be represented by hexadecimal color entities, like in the forums. So you could say set pen color to (fff). This would enable better manipulation of pen color, you could store the value in a string and as a variable.
I propose several new blocks for the execution of this idea:
This should be added because it allows better manipulation of colors. Hexadecimal entities are very precise, and can be stored in variables, whereas colors couldn't previously. The color () reporter still allows for the old ways of choosing colors. Hexadecimal entities also allow for thing like
Let me know what you think of this idea.
I propose several new blocks for the execution of this idea:
pen color :: pen reporterpen color reports the current pen color as a string
color [#f70] :: pen reporter
set pen color to [] :: pen stack
set pen color to [03f] :: pencolor () reports the hexadecimal entity for color for the color in the input. This color can be selected with the color picker tool, like old colors could.
pen color :: pen reporter // reports 03f as a string value
set pen color to (color [#f70] :: pen reporter) :: pen // color [#f70] reports the string f70, the entity of that colorset pen color to just accepts a string as an input, you can use it alongside color () to choose a color, or use a variable containing the color entity, or use a color entity you already know.
pen color :: pen reporter // so the pen color is now f70
This should be added because it allows better manipulation of colors. Hexadecimal entities are very precise, and can be stored in variables, whereas colors couldn't previously. The color () reporter still allows for the old ways of choosing colors. Hexadecimal entities also allow for thing like
if <(pen color :: pen reporter) = (color [#03f] :: pen reporter)> then
end
// or
set [next color v] to [5f5f5f]
set pen color to (next color) :: pen stack
// or even
set [color v] to (color [#5f5f5f] :: pen reporter)
(color) //reports 5f5f5f
Let me know what you think of this idea.
Last edited by theonlygusti (Aug. 5, 2014 12:41:31)
- PhirripSyrrip
-
Scratcher
500+ posts
Pen Improvement - Colors as Hexadecimal Entities.
Support. The ST will probably say that hexadecimal is too complicated for Scratch but as you said they already use it on the forums. Plus, hexadecimal is an important part of coding and computing and as long as the second block on your list is also present then the problem wouldn't exist.
- theonlygusti
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
Support. The ST will probably say that hexadecimal is too complicated for Scratch but as you said they already use it on the forums. Plus, hexadecimal is an important part of coding and computing and as long as the second block on your list is also present then the problem wouldn't exist.Thank you. I like your point on how Hexadecimal is important in other languages. And yes, the second block has been added so that colors can still be picked manually as they used to be. Also, I don't think many new Scratchers so much as see the pen palette until they have gained some more advanced knowledge, so I don't think the complexity of it will be a big problem.
- TimothyLawyer
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
The set pen color block with a color picker
set pen color to [#ff0088]supports numeric input.
set pen color to (pen color)For example, a hexadecimal color converter is possible in Scratch.
- stickfiregames
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
The problem with blocks like
Perhaps the blocks
set pen color to [03f]is that Scratch stores colours as a decimal number from 0 to 16777215, not hexadecimal. This makes it more confusing to use as the codes are less intuitive.
Perhaps the blocks
(color [#0033ff] :: pen)should be implemented, with both returning the decimal colour code and being placeable inside a colour input.
(color r:(0) g:(51) b:(255) :: pen)
Last edited by stickfiregames (Aug. 5, 2014 13:18:41)
- NDSDNS
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
I have used @TimothyLawyer's code for converting hex to decimal to Javascript. Download this zip file and unzip it. Open index.html in your browser. The paste a hex string into the textbox and click convert. If you have a hex color like #FF0000, take the # off. If you have a RGB value, search online for a converter. Then you can store the decimal in a variable. Useful for platformers. If you change your mind about the colors, you can just put in a different decimal.
- JonathanSchaffer
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
oooo support for all and
(color r: () g: () b: ()::pen)//you know what this is right?
Last edited by JonathanSchaffer (April 10, 2016 16:59:00)
- Sheep_maker
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
Support for
pen color) Because we have a bunch of other reporter blocks that report the attributes of the sprite/clone; should also be available in the “of” sensing block.
hex of) Useful for converting decimal into hexadecimal; the “0x” allows the hexadecimal number to be used in the numeral inputs
And my no-support reasons:
color) I actually would support this, but the pen color block does the job for it by setting the pen color using the color picker version.
(pen color::pen)//decimal; may cause confusion due to the two "set pen color" blocksI guess I should state my reasons now…
([hex v] of (9)::operators)//returns the value as "0x9"
pen color) Because we have a bunch of other reporter blocks that report the attributes of the sprite/clone; should also be available in the “of” sensing block.
hex of) Useful for converting decimal into hexadecimal; the “0x” allows the hexadecimal number to be used in the numeral inputs
And my no-support reasons:
color) I actually would support this, but the pen color block does the job for it by setting the pen color using the color picker version.
set pen color to [#ff0088]set pen color to string input) A string input would allow a new Scratcher to type anything (like the letter “z”), confusing them. A join block stuffed in the color picker version of the set pen color to block should do the trick.
(pen color::pen) //reports "0xff0088"
set pen color to (join[0x][0033ff])Oh, I would like to add that based on how Scratch works, the pen color block should return “0x33ff” instead of “0x03f” in the second example.
- BurnedCrystal
-
Scratcher
100+ posts
Pen Improvement - Colors as Hexadecimal Entities.
Support! The current setup is really confusing for poor me, who just started to understand hexadecimal :^
- The_Imagineer_
-
Scratcher
100+ posts
Pen Improvement - Colors as Hexadecimal Entities.
I think that pen colors should be represented by hexadecimal color entities, like in the forums. So you could say set pen color to (fff). This would enable better manipulation of pen color, you could store the value in a string and as a variable.Fun fact… this works:
I propose several new blocks for the execution of this idea:pen color :: pen reporterpen color reports the current pen color as a string
color [#f70] :: pen reporter
set pen color to [] :: pen stackset pen color to [03f] :: pencolor () reports the hexadecimal entity for color for the color in the input. This color can be selected with the color picker tool, like old colors could.
pen color :: pen reporter // reports 03f as a string valueset pen color to (color [#f70] :: pen reporter) :: pen // color [#f70] reports the string f70, the entity of that colorset pen color to just accepts a string as an input, you can use it alongside color () to choose a color, or use a variable containing the color entity, or use a color entity you already know.
pen color :: pen reporter // so the pen color is now f70
This should be added because it allows better manipulation of colors. Hexadecimal entities are very precise, and can be stored in variables, whereas colors couldn't previously. The color () reporter still allows for the old ways of choosing colors. Hexadecimal entities also allow for thing likeif <(pen color :: pen reporter) = (color [#03f] :: pen reporter)> then
end
// or
set [next color v] to [5f5f5f]
set pen color to (next color) :: pen stack
// or even
set [color v] to (color [#5f5f5f] :: pen reporter)
(color) //reports 5f5f5f
Let me know what you think of this idea.
set pen color to (join[hex code here]())and same with:
set [color v] effect to (join[hex code here]())
- wilhelm43
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
Lots of workaround, but support 

- Scratch04035
-
Scratcher
3 posts
Pen Improvement - Colors as Hexadecimal Entities.
Definetly support! Maybe even a
kind of block. The drop-down menu would include ‘RGB’, ‘Hex’, ‘HSL’, etc.
set pen [ v] to ()::#0fbd8c
kind of block. The drop-down menu would include ‘RGB’, ‘Hex’, ‘HSL’, etc.
- starlightsparker
-
Scratcher
1000+ posts
Pen Improvement - Colors as Hexadecimal Entities.
support,these don’t have easy workarounds iirc and could be EXTREMELY useful for pen projects
- Discussion Forums
- » Suggestions
-
» Pen Improvement - Colors as Hexadecimal Entities.