I am working on a school project where we are supposed to retrieve three color codes (for red, green and blue) from a number between 0-16777215 (because 256x256x256=16777216). I am unable to understand how this number can produce three color codes.
The following code was part A of the task, which I have resolved:
background = input ('Choose background color:')
innersq = input ('Choose color of inner square:')
# set up drawing
setup(330, 330, 0, 0)
screensize(315, 315)
goto(-60, 150)
# choosing colors
bgcolor(background)
color(innersq)
This code was made so that the user would enter a color green, blue, red etc.
The new code is supposed to get the input 0-16777215 and calculate a color code for each of the three main colors.
The last part of the code should end up something like this:
#choosing colors
bgcolor(Rb0-255, Gb0-255, Bb0-255)
color (Rb0-255, Gb0-255, Bb0-255)