About Monkey 2 › Forums › Monkey 2 Projects › Ted21 Color Palette and Color Panel and Palette
This topic contains 4 replies, has 3 voices, and was last updated by 
 nobuyuki
 2 years, 7 months ago.
- 
		AuthorPosts
 - 
		
			
				
August 28, 2016 at 10:49 am #3523
Phew. That was an interesting one.
What we have here are the 3 main color systems in ted21.
First on the right is the color panel. this will insert either the color RGB ( .0, .2, 1) or the color text (UIBlue, etc) into text, or replace a selected palette color
Next up in the main view is a mx2 color palette. You can change the color by using the right color panel “Usee color” button or the palette “use” button
Lastly is the lower palette mixer. This allows you to mix colors, create new palettes, replace colors, pick colors from an image, etc. Clicking the Use button will replace the selected color in a mx2 palette or write the RGB text (.1, .3, 1) into a text document.
Both the bottom and right panels do similar things, but in very different ways. the right one being fixed, the bottom being more artistic.
Attachments:
August 28, 2016 at 11:04 am #3525Note: (mainly to Mark…)
Every single graphics programs I ever used or seen and all tutorials/demo/what else about colors found – use the 0..255 range, never seen 0..1.
This means that if I would to use/create etc in MX2 a color I like (http://cloford.com/resources/colours/500col.htm) I need to ‘manually’ convert (or write a function to do it) in the internal notation.
Not handy.
So, it would be nice if you can handle HEX input or RGB (0..255) in the TED2 Color Palette Document.August 29, 2016 at 6:13 am #3532ok, took some digging and experimenting.
open modules/std/graphics/color.monkey2 and add this:
Monkey1234Function ColorI:Color( red:Float, green:Float, blue:Float, alpha:float = 255 )Return New Color( red / 255, green / 255, blue / 255, alpha / 255)Endsave and rebuild std
Now when you want a color
Just use ColorI(255,0,0) instead of Color(1,0,0)
August 29, 2016 at 10:58 am #3536Thanks, but I’ve already did this using the overriding (r g b as Int instead of Float).
But of course at every new revision I need to put my changes.August 31, 2016 at 2:09 pm #3580The reason it takes a floating-point argument for color is because that is what the underlying opengl does. This has been the case since forever, after people moved from 8-bit channel rendering internally to whatever the native hardware is offering. Using a floating point value allows the underlying Hardware to quantize it to the level of accuracy it processes stuff internally.
The main time this would be a disadvantage is actually with image editors, since you can’t necessarily guarantee 100% color accuracy if the internal Hardware renders colors without perfect accuracy for speed reasons. In those cases where speed is a “bonus” and accuracy comes first, editors usually have their own separate internal image processing engine anyway, only using opengl to speed up the output (or noncritical tasks). But mojo wasn’t designed for that specifically, it was designed for games.
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.
