Hello all,
I have a program that I have written that creates lots of small 'cnv' objects, where I am changing the colors of the backgrounds and the text in the object. I was noticing that when I create these cnv objects, I have to use a different 'color number' to get the same color when I change it with the cnv 'color' message (which changes both the background and text colors in the same message).
Is this documented anywhere as to the relation between these two different color definitions?
Mike
Mike McGonagle wrote:
Hello all,
I have a program that I have written that creates lots of small 'cnv' objects, where I am changing the colors of the backgrounds and the text in the object. I was noticing that when I create these cnv objects, I have to use a different 'color number' to get the same color when I change it with the cnv 'color' message (which changes both the background and text colors in the same message).
Is this documented anywhere as to the relation between these two different color definitions?
Not as far as I'm aware, but here's my implementations that work for me:
/* colour */ float r, g, b; /* 0<={r,g,b}<=1 */
/* RGB -> Pd file */ int c = ((((int) (r * 63.0)) << 12) | (((int) (g * 63.0)) << 6) | ((int) (b * 63.0))) ^ (-1);
/* RGB -> Pd message */ int c = ((((int) (r * 255.0)) << 16) | (((int) (g * 255.0)) << 8) | ((int) (b * 255.0))) ^ (-1);
Claude
Hallo, Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:
Mike McGonagle wrote:
Hello all,
I have a program that I have written that creates lots of small 'cnv' objects, where I am changing the colors of the backgrounds and the text in the object. I was noticing that when I create these cnv objects, I have to use a different 'color number' to get the same color when I change it with the cnv 'color' message (which changes both the background and text colors in the same message).
Is this documented anywhere as to the relation between these two different color definitions?
Not as far as I'm aware, but here's my implementations that work for me:
Also see this colorschemer for Pd: http://lists.puredata.info/pipermail/pd-list/2006-03/036005.html
Ciao
Hum, Thanks for this Frank. One question though, as it appears from what is in the docs (all the numbers are "doubled", ie 1 = 0x11, a = 0xaa, etc.), do these colors represent what you would get from the colors that get stored in the Pd file? In other words, the 8bit format for the colors?
Thanks again.
Mike
On Mon, Jul 7, 2008 at 1:17 PM, Frank Barknecht fbar@footils.org wrote:
Hallo, Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:
Mike McGonagle wrote:
Hello all,
I have a program that I have written that creates lots of small 'cnv' objects, where I am changing the colors of the backgrounds and the text
in
the object. I was noticing that when I create these cnv objects, I have
to
use a different 'color number' to get the same color when I change it
with
the cnv 'color' message (which changes both the background and text
colors
in the same message).
Is this documented anywhere as to the relation between these two
different
color definitions?
Not as far as I'm aware, but here's my implementations that work for me:
Also see this colorschemer for Pd: http://lists.puredata.info/pipermail/pd-list/2006-03/036005.html
Ciao
Frank Barknecht _ ______footils.org__
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Hi Mike, I made some objects to handle this in senderfruit/ (in extended) called color.rgb2pd24 (message color format) and color.rgb2pd18 (file color format). They both take lists of three RGB values scaled 0-1.
There's also color.hsl2rgb, which as you'd expect converts from HSL colorspace to RGB. HSL is useful for generating variants of a color (like a darker or lighter version).
Cheers Luke
On Mon, Jul 7, 2008 at 11:53 AM, Mike McGonagle mjmogo@gmail.com wrote:
Hum, Thanks for this Frank. One question though, as it appears from what is in the docs (all the numbers are "doubled", ie 1 = 0x11, a = 0xaa, etc.), do these colors represent what you would get from the colors that get stored in the Pd file? In other words, the 8bit format for the colors?
Thanks again.
Mike
On Mon, Jul 7, 2008 at 1:17 PM, Frank Barknecht fbar@footils.org wrote:
Hallo, Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:
Mike McGonagle wrote:
Hello all,
I have a program that I have written that creates lots of small 'cnv' objects, where I am changing the colors of the backgrounds and the text in the object. I was noticing that when I create these cnv objects, I have to use a different 'color number' to get the same color when I change it with the cnv 'color' message (which changes both the background and text colors in the same message).
Is this documented anywhere as to the relation between these two different color definitions?
Not as far as I'm aware, but here's my implementations that work for me:
Also see this colorschemer for Pd: http://lists.puredata.info/pipermail/pd-list/2006-03/036005.html
Ciao
Frank Barknecht _ ______footils.org__
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
-- Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. —Yehudi Menuhin (1916–1999), musician _______________________________________________ Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Hallo, Mike McGonagle hat gesagt: // Mike McGonagle wrote:
Hum, Thanks for this Frank. One question though, as it appears from what is in the docs (all the numbers are "doubled", ie 1 = 0x11, a = 0xaa, etc.), do these colors represent what you would get from the colors that get stored in the Pd file?
You mean in the README.txt of colorscheme? My remark there about "doubled" refers to hexcolors as used in HTML/CSS, where instead of the full 6-digit list to specify a color (as in "#ff00ee") you can also use a 3-digit list if you only have "doubles" (as in "#f0e"). Of course, values with all different digits like "#123456" cannot be collapsed this way, as #rgb doesn't have the depth for this.
Some of these collapsed colors were called "Web-Safe" colors in the old days (cf. http://en.wikipedia.org/wiki/Web_colors)
In the colorscheme I used the shorter triplets to make the already long lists for foreground, background and label colors of IEM-GUIs three times shorter: the full colorset for a [vsl] now is only 9 instead of 27 values long.
This has no connection to what's in the .pd-file. IEMGUIs can also display #rrggbb-colors, IIRC.
Ciao
Thanks, Claude. I was really wondering if this was something that I am doing wrong. Is this documented somewhere? If not, it should be. But then again, the internals of the file format are not documented as they should be. One of the things that I found in the Help file (no mention made of the differences between the file format and the message format), was that it was not clear to the person writing the help file as to what the last number does.
Guess I have something to document with my project. (Anyone up for some Sudoku in Pd?)
Mike
On Mon, Jul 7, 2008 at 1:06 PM, Claude Heiland-Allen < claudiusmaximus@goto10.org> wrote:
Mike McGonagle wrote:
Hello all,
I have a program that I have written that creates lots of small 'cnv' objects, where I am changing the colors of the backgrounds and the text in the object. I was noticing that when I create these cnv objects, I have to use a different 'color number' to get the same color when I change it with the cnv 'color' message (which changes both the background and text colors in the same message).
Is this documented anywhere as to the relation between these two different color definitions?
Not as far as I'm aware, but here's my implementations that work for me:
/* colour */ float r, g, b; /* 0<={r,g,b}<=1 */
/* RGB -> Pd file */ int c = ((((int) (r * 63.0)) << 12) | (((int) (g * 63.0)) << 6) | ((int) (b * 63.0))) ^ (-1);
/* RGB -> Pd message */ int c = ((((int) (r * 255.0)) << 16) | (((int) (g * 255.0)) << 8) | ((int) (b * 255.0))) ^ (-1);
Claude