RGB colors (range 0-63)

Started by arj0n, Wed 24/06/2020 14:06:13

Previous topic - Next topic

arj0n

I was playing around with changing colors in an 8-bit ags-project using something like:

Code: ags

palette[1].r = 60;
palette[1].g = 0;
palette[1].b = 0;
UpdatePalette();


My problem is how can I find the RGB values ags needs, being within that 0-63 range.
For example, the color cyan in paint.net is shown as having rgb values 85,255,255, so that's not within that 0-63 range.




In this 2006 post I noticed an image showing a color from the palette been selected and the rgb values been shown in that 0-63 range.
This is kind-of what I would need:



arj0n

Because the manual shows that:

Quote
UpdatePalette()
Commits the changes you made to the game palette. The script global variable palette[] stores the state of all the colours of the palette. You can access the red, green and blue components with .r, .g and .b. The values range from 0 to 63.
Example:

palette[16].r = 60;
UpdatePalette();
will make the black colour turn bright red. When you actually change the variable, nothing happens. Call this function to update the screen

Crimson Wizard

#2
Sorry, this is part of AGS I don't know very well. (I deleted my previous post)

Thinking logically, if palette colours go 0-63 and correspond to 0-255 you need to take color values from your paint program and convert them from 255-range to 63-range:

COLOR_63 = COLOR_255 * 63 / 255


EDIT: So, Cyan should be something like 21, 62, 62

arj0n


arj0n

Quote from: Crimson Wizard on Wed 24/06/2020 14:42:13
COLOR_63 = COLOR_255 * 63 / 255
Yep, that does the trick. Thank you!

SMF spam blocked by CleanTalk