[PD-dev] pd file format: color settings
Robert Schwarz
mail at rschwarz.net
Sat Feb 13 22:25:14 CET 2010
Hi all,
I recently tried writing patches in a text editor (or from scripts) and
had problems getting the color settings right, for bang elements.
There is some documentation at
http://puredata.info/docs/developer/fileformat
with the explanation:
>
> Color: Some graphical elements have color attributes. Per color only
> one signed integer value is stored that contains the three 8-bit
> color components (RGB). Formula to calculate color attribute values:
>
> color = ( [red] * -65536) + ( [green] * -256) + ( [blue] * -1)
>
> Where [red], [green], [blue] obviously represent the three color
> components, their values range from 0 to 255. They apply to the
> attributes [background color], [front color], [label color] of
> various elements.
I tried that, but it didn't work. Instead of showing the whole spectrum
I just got different shades of blue. Also, when I opened one of my
handwritten patches in PureData, looked at the color settings and saved,
the resulting numbers changed. I assume that some kind of rounding is
happening, and colors are actually saved in lower resolution.
Do you have any ideas?
Also, my application is a 13x13 button matrix, each triggering different
chords via MIDI. The buttons should be color coded. Obviously, it's too
much work setting all colors individually and I might want to create
several of these patches with different colors.
Maybe there is another obvious solution I didn't see.
Any help is appreciated!
(I'm using standard pd 0.42_5 on Arch Linux, but this shouldn't make a
difference.)
--
Robert Schwarz <mail at rschwarz.net>
Get my public key at http://rschwarz.net/key.asc
More information about the Pd-dev
mailing list