I am using Squeak 5.1. Sorry if this has already been fixed.
It's nice to have the additional named colors (the crayon color names) but unfortunately if you do for example:
"Color banana name"
you don't get #banana but instead get the unnamed color specifics. I wrote the following code to fix this. Feel free to use it or even add it to the next version of squeak under the squeak license.
Ralph Boland
initializeCrayonNames "Name crayon colors. The following colors were removed as they are duplicates: maraschino (red) lemon (yellow) snow (white) licorice (black) cantaloupe (lightOrange)"
"Color initializeCrayonNames" "example: Color blueberry name"
| crayonColors |
crayonColors := #(aluminum aqua asparagus banana blueberry bubblegum cantaloupe carnation cayenne clover eggplant fern flora grape honeydew ice iron lavender lead licorice lime magnesium maroon mercury midnight mocha moss nickel ocean orchid plum salmon seaFoam silver sky snow spindrift spring steel strawberry tangerine teal tin tungsten turquoise).
crayonColors do: [:color | self named: color put: (Color perform: color)].
Hi Ralph,
thanks for your suggestion. Since the names are already encoded in the messages and some order is already defined in Color >> #orderedCrayonColors, you could just do this:
Color orderedCrayonColors keyAtValue: Color banana.
Anyway, you pointed out an issue with color naming and the new crayon colors. I will fix this in the Trunk. Thanks again. :)
Best, Marcel
-- View this message in context: http://forum.world.st/color-names-for-crayons-tp4945822p4952898.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
Anyhow, makes sense to have a cache:
[Color r: 0 g: 0 b: 0] bench '3,410,000 per second. 293 nanoseconds per run.' [Color black] bench '128,000,000 per second. 7.8 nanoseconds per run.'
:-)
Best, Marcel
-- View this message in context: http://forum.world.st/color-names-for-crayons-tp4945822p4952901.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
squeak-dev@lists.squeakfoundation.org