Difference between revisions of "User:Toady Nakamura/Color Chooser"

From Second Life Wiki
Jump to navigation Jump to search
m (added color picker script)
 
m (color table)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


To see it work for yourself, place this in a prim, and do what it tells you to do!!
To see it work for yourself, place this in a prim, and do what it tells you to do!!
 
<source lang = "lsl2">
<lsl>
 
 
tell()  
tell()  
{  
{  
     vector color = llGetColor(0);   // find out what color the prim is now
     vector color = llGetColor(0);
     llOwnerSay("Color Vector is  "+(string)color ); // tell the owner the current vector by typecasting (string)vector
     string cName = (string)llGetColor(0);
     llSetText("Color Vector: \n \n "+(string)color, color, 1.0); // post vector in hover text in same color
    llWhisper(0,"Color Vector is  "+ cName );  
     llSetText("Color Vector: \n ~ < Red ,  Green , Blue > ~ \n "+ cName +
    "\n Change the Color in edit/texture tab \n to learn new color vector.", color, 1.0);
}  
}  


Line 17: Line 16:
     state_entry()  
     state_entry()  
     {  
     {  
      llOwnerSay("Change the Color in edit/texture tab; the ball will tell you the new color vector and post it in hover text!");
        tell();
    }
 
    on_rez(integer foo)
    {
        llResetScript();  
     }  
     }  


Line 23: Line 27:
     {  
     {  
         tell(); // usually you will hear the color by changing it
         tell(); // usually you will hear the color by changing it
                 // this is here for poky fingered owners
                 // this is here for poky fingered owners or other uses
     }  
     }  


Line 30: Line 34:
         if (change & CHANGED_COLOR)  
         if (change & CHANGED_COLOR)  
         {  
         {  
             tell(); // change the color in edit, it tells & posts the new vector
             tell();  
         }  
         }  
     }
     }  
}
</source>
 


    on_rez(integer foo)
{{{!}} class="sortable" {{Prettytable}}
    {  
{{!}}- {{Hl2}}
        llResetScript(); // reset on rezz to repeat instructions
! Color
    }
! Hexadecimal code
}
! LSL color representations
</lsl>
{{!}}-
{{!}} style="color: white; background: #001f3f" {{!}}NAVY
{{!}} #001f3f
{{!}}<code><0.000, 0.122, 0.247></code>
{{!}}-
{{!}} style="background: #0074d9" {{!}}BLUE
{{!}} #0074d9
{{!}}<code><0.000, 0.455, 0.851></code>
{{!}}-
{{!}} style="background: #7fdbff" {{!}}AQUA
{{!}} #7fdbff
{{!}}<code><0.498, 0.859, 1.000></code>
{{!}}-
{{!}} style="background: #39cccc" {{!}}TEAL
{{!}} #39cccc
{{!}}<code><0.224, 0.800, 0.800></code>
{{!}}-
{{!}} style="background: #3d9970" {{!}}OLIVE
{{!}} #3d9970
{{!}}<code><0.239, 0.600, 0.439></code>
{{!}}-
{{!}} style="background: #2ecc40" {{!}}GREEN
{{!}} #2ecc40
{{!}}<code><0.180, 0.800, 0.251></code>
{{!}}-
{{!}} style="background: #01ff70" {{!}}LIME
{{!}} #01ff70
{{!}}<code><0.004, 1.000, 0.439></code>
{{!}}-
{{!}} style="background: #ffdc00" {{!}}YELLOW
{{!}} #ffdc00
{{!}}<code><1.000, 0.863, 0.000></code>
{{!}}-
{{!}} style="background: #ff851b" {{!}}ORANGE
{{!}} #ff851b
{{!}}<code><1.000, 0.522, 0.106></code>
{{!}}-
{{!}} style="background: #ff4136" {{!}}RED
{{!}} #ff4136
{{!}}<code><1.000, 0.255, 0.212></code>
{{!}}-
{{!}} style="color: white; background: #85144b" {{!}}MAROON
{{!}} #85144b
{{!}}<code><0.522, 0.078, 0.294></code>
{{!}}-
{{!}} style="background: #f012be" {{!}}FUCHSIA
{{!}} #f012be
{{!}}<code><0.941, 0.071, 0.745></code>
{{!}}-
{{!}} style="color: white; background: #b10dc9" {{!}}PURPLE
{{!}} #b10dc9
{{!}}<code><0.694, 0.051, 0.788></code>
{{!}}-
{{!}} style="background: #ffffff" {{!}}WHITE
{{!}} #ffffff
{{!}}<code><1.000, 1.000, 1.000></code>
{{!}}-
{{!}} style="background: #dddddd" {{!}}SILVER
{{!}} #dddddd
{{!}}<code><0.867, 0.867, 0.867></code>
{{!}}-
{{!}} style="background: #aaaaaa" {{!}}GRAY
{{!}} #aaaaaa
{{!}}<code><0.667, 0.667, 0.667></code>
{{!}}-
{{!}} style="color: white; background: #111111" {{!}}BLACK
{{!}} #111111
{{!}}<code><0.067, 0.067, 0.067></code>
{{!}}}
 
More interesting scripts on my user page! [[User:Toady Nakamura|Toady Nakamura]] 12:07, 27 August 2012 (PDT)

Latest revision as of 15:58, 30 July 2015

This is extremely handy for picking good colors of hover text as well as for finding out the color vector of a prim, to use in particles for example. The prim color is close to a particle that isn't Emissive (glow), while the hover text is very similar to particles with Glow enabled.

To see it work for yourself, place this in a prim, and do what it tells you to do!!

tell() 
{ 
    vector color = llGetColor(0);
    string cName = (string)llGetColor(0); 
    llWhisper(0,"Color Vector is  "+ cName ); 
    llSetText("Color Vector: \n  ~ < Red ,  Green , Blue > ~ \n "+ cName +
    "\n Change the Color in edit/texture tab \n to learn new color vector.", color, 1.0);
} 

default 
{ 
    state_entry() 
    { 
        tell();
    } 

    on_rez(integer foo) 
    { 
        llResetScript(); 
    } 

    touch_start(integer number) 
    { 
        tell(); // usually you will hear the color by changing it
                // this is here for poky fingered owners or other uses
    } 

    changed(integer change) 
    { 
        if (change & CHANGED_COLOR) 
        { 
            tell(); 
        } 
    } 
}


Color Hexadecimal code LSL color representations
NAVY #001f3f <0.000, 0.122, 0.247>
BLUE #0074d9 <0.000, 0.455, 0.851>
AQUA #7fdbff <0.498, 0.859, 1.000>
TEAL #39cccc <0.224, 0.800, 0.800>
OLIVE #3d9970 <0.239, 0.600, 0.439>
GREEN #2ecc40 <0.180, 0.800, 0.251>
LIME #01ff70 <0.004, 1.000, 0.439>
YELLOW #ffdc00 <1.000, 0.863, 0.000>
ORANGE #ff851b <1.000, 0.522, 0.106>
RED #ff4136 <1.000, 0.255, 0.212>
MAROON #85144b <0.522, 0.078, 0.294>
FUCHSIA #f012be <0.941, 0.071, 0.745>
PURPLE #b10dc9 <0.694, 0.051, 0.788>
WHITE #ffffff <1.000, 1.000, 1.000>
SILVER #dddddd <0.867, 0.867, 0.867>
GRAY #aaaaaa <0.667, 0.667, 0.667>
BLACK #111111 <0.067, 0.067, 0.067>

More interesting scripts on my user page! Toady Nakamura 12:07, 27 August 2012 (PDT)