13 September 2011

C is for Color: Alphabet Game

Color. Prim color.

The color picker window on the viewer has several slots for you to save custom colors, but what about when you need more? Or what if you're working with a group and want to share colors? Why not make your own palette?

Rez a cube. I add a greyscale radial gradient texture to it, but that's up to you. Set it to full-bright. Copy the prim several times to make a row of prims. Link them together. Now as you pick colors for your project, set one of the prims in your palette to that color. Wear the palette as a HUD if prims are tight on your parcel, or leave it rezzed for collaborative building.

If you're doing scripting, you may need color information in RGB <0-1,0-1,0-1> format. Unfortunately the official viewer doesn't offer it that way in the color picker window. I add a root prim to my palettes (see that black prim behind the others on the top left?) and place this script in it. When you touch a color, it whispers the color information in that format.

  touch_start(integer p)
   integer linknum = llDetectedLinkNumber( 0 );
   list l = llGetLinkPrimitiveParams( linknum, [PRIM_COLOR, ALL_SIDES] );
   vector color = llList2Vector( l, 0 );
   llWhisper( 0, (string)color );

No comments: