RGB function doesn't seem to cover certain values.

12 views
Skip to first unread message

Brandon Barker

unread,
Oct 1, 2020, 10:11:19 AM10/1/20
to codeworld-discuss
Maybe it is some sort of discretization issue, but we recently found that certain shades don't seem to render (or just show as white). Here is an example (see comments at bottom):

program = drawingOf(scene & coordinatePlane)
scene   = house(red)
house(roofColor) = colored(roof, roofColor) & door & windows & blackDoor & frame
roof = translated(thickArc(45, 135, 6, 1), 0, -1)
frame = colored(solidRectangle(7, 8.9),brown)
blueWindow = colored(solidRectangle(2,2), lights)
window = translated(blueWindow, 1.5, 2)
window2 = translated(blueWindow, -1.5, 2)
windows = window & window2
door = translated(blackDoor, 0, -2)
blackDoor = colored(solidRectangle(2, 2), black)
-- this works:
-- lights = RGB(221, 255, 0)
-- this doesn't:
lights = RGB(230, 215, 57)

The non-working yellow shade was obtained from the google color picker.

Chris Smith

unread,
Oct 1, 2020, 10:21:49 AM10/1/20
to codeworl...@googlegroups.com
The arguments to RGB are between 0 and 1, so try this: RGB(230/255, 215/255, 57/255).  If you use an argument outside of (0, 1), it is clipped to that range, so RGB(221, 255, 0) is actually just RGB(1, 1, 0).

I do think it would be an improvement to show a warning message about this the first time it happens, so I'll file a bug for that change.

--
You received this message because you are subscribed to the Google Groups "codeworld-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codeworld-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codeworld-discuss/cd3dfc99-ee32-43b1-aeee-c1751fa772c5n%40googlegroups.com.

Chris Smith

unread,
Oct 1, 2020, 10:24:48 AM10/1/20
to codeworl...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages