Discuss Scratch
- DarkXSeries7
-
100+ posts
color coded variables
So people can color code them based on what they should be (e.g. if you want to remember a variable is a boolean, make it red)
- musicROCKS013
-
1000+ posts
color coded variables
How would you change the variable color? Could you right click to do so, or what?
Also, is there something in place where if someone makes a variable too light the text color will automatically switch to black? If so, how bright would that be?
Also, is there something in place where if someone makes a variable too light the text color will automatically switch to black? If so, how bright would that be?
- DarkXSeries7
-
100+ posts
color coded variables
as soon as the contrast is less than 20% ig? How would you change the variable color? Could you right click to do so, or what?
Also, is there something in place where if someone makes a variable too light the text color will automatically switch to black? If so, how bright would that be?
and yes probably a dropdown like with “when touching color”
- banana439monkey
-
1000+ posts
color coded variables
what is a boolean?
i'm serious
in javascript, a boolean will either return true or false
you can create your own, else how would you be able to really write decent javascript?
that said, because of scratch's appeal to children, typing is extremely loose
we do truly want custom reporters and booleans! they would mean the world to us
sadly the above has to be implemented using the workaround, setting a variable to “true” or “false”.
to scratch, a variable is a string (unless incremented but eurgh)
true and false are of different types
and because users set variables to “true” or “false”, those are strings.
“true” != true
as with false, “false” != false
not even loosely the same
i don't know if scratch uses strict or loose equalities with 0 and 1
technically, the following:
0 == false
0 !== false
1 == true
-1 == true
1 !== true
-1 !== true
what i'm saying here is it's just not possible because users will report strings into variables. even if they report 0 or 1, does scratch allow the user to equate them to true or false? i mean after all, unlike javascript, you can't enter a value as a boolean to even see if it exists. the problem is also exacerbated by the fact that a variable can be set to any old value throughout the runtime of the project. it is just not possible with the way scratch is currently architected, at least not without some major reconstruction within the editor and under the hood. even if all of that, it would end up being unintuitive to scratch's target audience
Banana
i'm serious
in javascript, a boolean will either return true or false
you can create your own, else how would you be able to really write decent javascript?
that said, because of scratch's appeal to children, typing is extremely loose
we do truly want custom reporters and booleans! they would mean the world to us
sadly the above has to be implemented using the workaround, setting a variable to “true” or “false”.
to scratch, a variable is a string (unless incremented but eurgh)
true and false are of different types
and because users set variables to “true” or “false”, those are strings.
“true” != true
as with false, “false” != false
not even loosely the same
i don't know if scratch uses strict or loose equalities with 0 and 1
technically, the following:
0 == false
0 !== false
1 == true
-1 == true
1 !== true
-1 !== true
what i'm saying here is it's just not possible because users will report strings into variables. even if they report 0 or 1, does scratch allow the user to equate them to true or false? i mean after all, unlike javascript, you can't enter a value as a boolean to even see if it exists. the problem is also exacerbated by the fact that a variable can be set to any old value throughout the runtime of the project. it is just not possible with the way scratch is currently architected, at least not without some major reconstruction within the editor and under the hood. even if all of that, it would end up being unintuitive to scratch's target audience
Banana
- DarkXSeries7
-
100+ posts
color coded variables
1 or 0 what is a boolean?
i'm serious
in javascript, a boolean will either return true or false
you can create your own, else how would you be able to really write decent javascript?
that said, because of scratch's appeal to children, typing is extremely loose
we do truly want custom reporters and booleans! they would mean the world to us
sadly the above has to be implemented using the workaround, setting a variable to “true” or “false”.
to scratch, a variable is a string (unless incremented but eurgh)
true and false are of different types
and because users set variables to “true” or “false”, those are strings.
“true” != true
as with false, “false” != false
not even loosely the same
i don't know if scratch uses strict or loose equalities with 0 and 1
technically, the following:
0 == false
0 !== false
1 == true
-1 == true
1 !== true
-1 !== true
what i'm saying here is it's just not possible because users will report strings into variables. even if they report 0 or 1, does scratch allow the user to equate them to true or false? i mean after all, unlike javascript, you can't enter a value as a boolean to even see if it exists. the problem is also exacerbated by the fact that a variable can be set to any old value throughout the runtime of the project. it is just not possible with the way scratch is currently architected, at least not without some major reconstruction within the editor and under the hood. even if all of that, it would end up being unintuitive to scratch's target audience
Banana
- banana439monkey
-
1000+ posts
color coded variables
ok well in that case1 or 0 what is a boolean?
i'm serious
in javascript, a boolean will either return true or false
you can create your own, else how would you be able to really write decent javascript?
that said, because of scratch's appeal to children, typing is extremely loose
we do truly want custom reporters and booleans! they would mean the world to us
sadly the above has to be implemented using the workaround, setting a variable to “true” or “false”.
to scratch, a variable is a string (unless incremented but eurgh)
true and false are of different types
and because users set variables to “true” or “false”, those are strings.
“true” != true
as with false, “false” != false
not even loosely the same
i don't know if scratch uses strict or loose equalities with 0 and 1
technically, the following:
0 == false
0 !== false
1 == true
-1 == true
1 !== true
-1 !== true
what i'm saying here is it's just not possible because users will report strings into variables. even if they report 0 or 1, does scratch allow the user to equate them to true or false? i mean after all, unlike javascript, you can't enter a value as a boolean to even see if it exists. the problem is also exacerbated by the fact that a variable can be set to any old value throughout the runtime of the project. it is just not possible with the way scratch is currently architected, at least not without some major reconstruction within the editor and under the hood. even if all of that, it would end up being unintuitive to scratch's target audience
Banana
how does scratch know that it's a boolean? what if a user sets the boolean in the project's initialisation and not manually? what if they don't use 0 or 1? what if 0/1 becomes a score? the default for a variable is 0 so would it automatically be detected as a boolean? having scratch change variables on the fly might also mean that block colours change throughout the project, that looks completely janky and highly confusing
Banana
- musicROCKS013
-
1000+ posts
color coded variables
-snip-
I think you're questioning the wrong aspect of this suggestion and kind of going off topic…
- DarkXSeries7
-
100+ posts
color coded variables
dude it doesent do anything it just color codes it do you honestly think 8 year olds are expected to know all variable typesok well in that case1 or 0 what is a boolean?
i'm serious
in javascript, a boolean will either return true or false
you can create your own, else how would you be able to really write decent javascript?
that said, because of scratch's appeal to children, typing is extremely loose
we do truly want custom reporters and booleans! they would mean the world to us
sadly the above has to be implemented using the workaround, setting a variable to “true” or “false”.
to scratch, a variable is a string (unless incremented but eurgh)
true and false are of different types
and because users set variables to “true” or “false”, those are strings.
“true” != true
as with false, “false” != false
not even loosely the same
i don't know if scratch uses strict or loose equalities with 0 and 1
technically, the following:
0 == false
0 !== false
1 == true
-1 == true
1 !== true
-1 !== true
what i'm saying here is it's just not possible because users will report strings into variables. even if they report 0 or 1, does scratch allow the user to equate them to true or false? i mean after all, unlike javascript, you can't enter a value as a boolean to even see if it exists. the problem is also exacerbated by the fact that a variable can be set to any old value throughout the runtime of the project. it is just not possible with the way scratch is currently architected, at least not without some major reconstruction within the editor and under the hood. even if all of that, it would end up being unintuitive to scratch's target audience
Banana
how does scratch know that it's a boolean? what if a user sets the boolean in the project's initialisation and not manually? what if they don't use 0 or 1? what if 0/1 becomes a score? the default for a variable is 0 so would it automatically be detected as a boolean? having scratch change variables on the fly might also mean that block colours change throughout the project, that looks completely janky and highly confusing
Banana
Last edited by DarkXSeries7 (Aug. 2, 2022 21:20:17)
- banana439monkey
-
1000+ posts
color coded variables
this isn’t offtopic, this is theorising the mechanic of how the feature would work-snip-
I think you're questioning the wrong aspect of this suggestion and kind of going off topic…
#8, see this post too
Banana
- musicROCKS013
-
1000+ posts
color coded variables
I'm pretty sure what they meant is this, “If you have a variable that you want to store 0 or 1 in, you can make it red.” this is theorising the mechanic of how the feature would work
This isn't suggesting boolean variables, it is suggesting that you can change the color of variables, so it is offtopic, right? this isn’t offtopic
Color coding is a use they will have. Changing the variable colors is the actual suggestion.
- banana439monkey
-
1000+ posts
color coded variables
changing the colour of variables if they are booleans so no it is not offtopicI'm pretty sure what they meant is this, “If you have a variable that you want to store 0 or 1 in, you can make it red.” this is theorising the mechanic of how the feature would workThis isn't suggesting boolean variables, it is suggesting that you can change the color of variables, so it is offtopic, right? this isn’t offtopic
Color coding is a use they will have. Changing the variable colors is the actual suggestion.
and how do you define whether you want to store 0 or 1 in a variable? at that point why can't we use custom reporters?
Banana
- RL1123
-
1000+ posts
color coded variables
Yep, so basically, if the variable is used like a boolean but not actually a boolean, then color code it like that.I'm pretty sure what they meant is this, “If you have a variable that you want to store 0 or 1 in, you can make it red.” this is theorising the mechanic of how the feature would work
But I don't see the point of this. If anything, this will confuse users. You see, the colors of the blocks determine what section they are in, so it'd be confusing to have a variable that's the same color as the looks blocks and it's not in the looks section.

Currently, you can just type out the classification of your variable. For example, if it's for all sprites, USE ALL UPPERCASE. If it's for this sprite, use lowercase.
- musicROCKS013
-
1000+ posts
color coded variables
Here is what the OP says: changing the colour of variables if they are booleans so no it is not offtopic
e.g. if you want to remember a variable is a boolean, make it red)This is an example of how it could be used, not the actual suggestion. (
if you want to remember a variable is a boolean, make it red)This lets us assume that this is being done by the creator, and that the creator is editing the colors in accordance to how they use the variable. Variables aren't automatically changed. (e.g.
- DarkXSeries7
-
100+ posts
color coded variables
yesHere is what the OP says: changing the colour of variables if they are booleans so no it is not offtopice.g. if you want to remember a variable is a boolean, make it red)This is an example of how it could be used, not the actual suggestion. (if you want to remember a variable is a boolean, make it red)This lets us assume that this is being done by the creator, and that the creator is editing the colors in accordance to how they use the variable. Variables aren't automatically changed. (e.g.
- DarkXSeries7
-
100+ posts
color coded variables
maybe they could have an orange stroke? idk users change the color themselves to inform its a specific variableYep, so basically, if the variable is used like a boolean but not actually a boolean, then color code it like that.I'm pretty sure what they meant is this, “If you have a variable that you want to store 0 or 1 in, you can make it red.” this is theorising the mechanic of how the feature would work
But I don't see the point of this. If anything, this will confuse users. You see, the colors of the blocks determine what section they are in, so it'd be confusing to have a variable that's the same color as the looks blocks and it's not in the looks section.
Currently, you can just type out the classification of your variable. For example, if it's for all sprites, USE ALL UPPERCASE. If it's for this sprite, use lowercase.
but i could defo see someone looking at the source code and seeing a non variable and being confused so i thing orange strokes should work
even with ue variables can be things other than numbers and letters, which is why color coding exists in the first place there
Last edited by DarkXSeries7 (Aug. 3, 2022 14:31:27)
- mitdk
-
1000+ posts
color coded variables
I feel like this might be a dupe, let me know if i'm wrong on how i'm interpreting this suggestion:
https://scratch.mit.edu/discuss/topic/516871/?page=1
https://scratch.mit.edu/discuss/topic/516871/?page=1
- musicROCKS013
-
1000+ posts
color coded variables
This is for changing the display color of variables, but not the color in the editor. For example: I feel like this might be a dupe, let me know if i'm wrong on how i'm interpreting this suggestion:
https://scratch.mit.edu/discuss/topic/516871/?page=1
You could change this:
to look like these:
- DarkXSeries7
-
100+ posts
color coded variables
a bit useless, not useful for developement or gameplay I feel like this might be a dupe, let me know if i'm wrong on how i'm interpreting this suggestion:
https://scratch.mit.edu/discuss/topic/516871/?page=1
- Thingied
-
1000+ posts
color coded variables
Can't you do this with prefixes? The result is basically the same.
- DarkXSeries7
-
100+ posts
color coded variables
i guess Can't you do this with prefixes? The result is basically the same.
but humans see colors faster than characters