|
|
Line 1: |
Line 1: |
| {{LSL Header}} | | {{LSL Header}} |
| ==Color script== | | ==Color script== |
| Created by: Masakazu Kojima
| | Compare: |
| Reposted by: ALicia Sautereau
| | * [[ColorConvert]] |
| | * {{LSLGC|Color}} |
| | Color lists: |
| | * [http://www.w3schools.com/HTML/html_colornames.asp common HTML color names] |
| | * [http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors web safe colors] |
|
| |
|
| This script allows choosing colors based on the [http://www.w3schools.com/HTML/html_colornames.asp common HTML color names] used by major web browsers.
| |
| <lsl> | | <lsl> |
| // This code is public domain. | | // Created by: Masakazu Kojima |
| // masa was here 20050302 | | // Reposted by: ALicia Sautereau |
|
| | |
| integer CHANNEL = 0; // channel to listen for commands on | | integer CHANNEL = PUBLIC_CHANNEL; // channel to listen for commands on |
| integer OWNER_ONLY = FALSE; // only owner can control | | integer OWNER_ONLY = FALSE; // only owner can control |
| integer USE_IMS = TRUE; // send IMs instead of using chat | | integer USE_IMS = TRUE; // send IMs instead of using chat |
| string COMMAND_CHANGE_COLOR = "change"; // command to change color | | string COMMAND_CHANGE_COLOR = "change"; // command to change color |
| string COMMAND_LIST_COLORS = "listcolors"; // command to list colors | | string COMMAND_LIST_COLORS = "listcolors"; // command to list colors |
| integer MAX_CHAT_LENGTH = 255; // max size for one message | | integer MAX_CHAT_LENGTH = 255; // max size for one message |
| string PREFIX_HEX = "#"; // prefix to specify hex code | | string PREFIX_HEX = "#"; // prefix to specify hex code |
| string PREFIX_VECTOR = "<"; // prefix to specify vector code | | string PREFIX_VECTOR = "<"; // prefix to specify vector code |
| list LINKS_TO_SET = [LINK_SET, ALL_SIDES]; // [link number, link face, ...] | | list LINKS_TO_SET = [LINK_SET, ALL_SIDES]; // [link number, link face, ...] |
|
| | |
| list COLORS; | | list COLORS; |
|
| | |
| // the list is too big to set at once :o
| |
| // note that you may get syntax errors and need to rearrange this list
| |
| // if you change the script much.
| |
| set_colors() { | | set_colors() { |
| COLORS = [ | | COLORS = [ |
| // http://www.w3schools.com/HTML/html_colornames.asp | | "navy", "#001f3f", |
| "steelblue", "#4682B4", "royalblue", "#041690", "cornflowerblue", "#6495ED",
| | "blue", "#0074d9", |
| "lightsteelblue", "#B0C4DE", "mediumslateblue", "#7B68EE", "slateblue", "#6A5ACD",
| | "aqua", "#7fdbff", |
| "darkslateblue", "#483D8B", "midnightblue", "#191970", "navy", "#000080",
| | "teal", "#39cccc", |
| "darkblue", "#00008B", "mediumblue", "#0000CD", "blue", "#0000FF", | | "olive", "#3d9970", |
| "dodgerblue", "#1E90FF", "deepskyblue", "#00BFFF", "lightskyblue", "#87CEFA", | | "green", "#2ecc40", |
| "skyblue", "#87CEEB", "lightblue", "#ADD8E6", "powderblue", "#B0E0E6",
| | "lime", "#01ff70", |
| "azure", "#F0FFFF", "lightcyan", "#E0FFFF", "paleturquoise", "#AFEEEE",
| | "yellow", "#ffdc00", |
| "mediumturquoise", "#48D1CC", "lightseagreen", "#20B2AA", "darkcyan", "#008B8B",
| | "orange", "#ff851b", |
| "teal", "#008080", "cadetblue", "#5F9EA0", "darkturquoise", "#00CED1", | | "red", "#ff4136", |
| "aqua", "#00FFFF", "cyan", "#00FFFF", "turquoise", "#40E0D0", | | "maroon", "#85144b", |
| "aquamarine", "#7FFFD4", "mediumaquamarine", "#66CDAA", "darkseagreen", "#8FBC8F"
| | "fuchsia", "#f012be", |
| ] + [
| | "purple", "#b10dc9", |
| "mediumseagreen", "#3CB371", "seagreen", "#2E8B57", "darkgreen", "#006400",
| | "white", "#ffffff", |
| "green", "#008000", "forestgreen", "#228B22", "limegreen", "#32CD32", | | "silver", "#dddddd", |
| "lime", "#00FF00", "chartreuse", "#7FFF00", "lawngreen", "#7CFC00", | | "gray", "#aaaaaa", |
| "greenyellow", "#ADFF2F", "yellowgreen", "#9ACD32", "palegreen", "#98FB98",
| | "black", "#111111" |
| "lightgreen", "#90EE90", "springgreen", "#00FF7F", "mediumspringgreen", "#00FA9A",
| |
| "darkolivegreen", "#556B2F", "olivedrab", "#6B8E23", "olive", "#808000", | |
| "darkkhaki", "#BDB76B", "darkgoldenrod", "#B8860B", "goldenrod", "#DAA520",
| |
| "gold", "#FFD700", "yellow", "#FFFF00", "khaki", "#F0E68C", "palegoldenrod", "#EEE8AA",
| |
| "blanchedalmond", "#FFEBCD", "moccasin", "#FFE4B5", "wheat", "#F5DEB3", | |
| "navajowhite", "#FFDEAD", "burlywood", "#DEB887", "tan", "#D2B48C" | |
| ] + [
| |
| "rosybrown", "#BC8F8F", "sienna", "#A0522D", "saddlebrown", "#8B4513", | |
| "chocolate", "#D2691E", "peru", "#CD853F", "sandybrown", "#F4A460",
| |
| "darkred", "#8B0000", "maroon", "#800000", "brown", "#A52A2A",
| |
| "firebrick", "#B22222", "indianred", "#CD5C5C", "lightcoral", "#F08080",
| |
| "salmon", "#FA8072", "darksalmon", "#E9967A", "lightsalmon", "#FFA07A",
| |
| "coral", "#FF7F50", "tomato", "#FF6347", "darkorange", "#FF8C00",
| |
| "orange", "#FFA500", "orangered", "#FF4500", "crimson", "#DC143C", | |
| "red", "#FF0000", "deeppink", "#FF1493", "fuchsia", "#FF00FF",
| |
| "magenta", "#FF00FF", "hotpink", "#FF69B4", "lightpink", "#FFB6C1",
| |
| "pink", "#FFC0CB", "palevioletred", "#DB7093", "mediumvioletred", "#C71585"
| |
| ] + [
| |
| "purple", "#800080", "darkmagenta", "#8B008B", "mediumpurple", "#9370DB", | |
| "blueviolet", "#8A2BE2", "indigo", "#4B0082", "darkviolet", "#9400D3",
| |
| "darkorchid", "#9932CC", "mediumorchid", "#BA55D3", "orchid", "#DA70D6", | |
| "violet", "#EE82EE", "plum", "#DDA0DD", "thistle", "#D8BFD8",
| |
| "lavender", "#E6E6FA", "ghostwhite", "#F8F8FF", "aliceblue", "#F0F8FF",
| |
| "mintcream", "#F5FFFA", "honeydew", "#F0FFF0", "lightgoldenrodyellow", "#FAFAD2",
| |
| "lemonchiffon", "#FFFACD", "cornsilk", "#FFF8DC", "lightyellow", "#FFFFE0",
| |
| "ivory", "#FFFFF0", "floralwhite", "#FFFAF0", "linen", "#FAF0E6",
| |
| "oldlace", "#FDF5E6", "antiquewhite", "#FAEBD7", "bisque", "#FFE4C4 ",
| |
| "peachpuff", "#FFDAB9", "papayawhip", "#FFEFD5", "beige", "#F5F5DC"
| |
| ] + [
| |
| "seashell", "#FFF5EE", "lavenderblush", "#FFF0F5", "mistyrose", "#FFE4E1",
| |
| "snow", "#FFFAFA", "white", "#FFFFFF", "whitesmoke", "#F5F5F5",
| |
| "gainsboro", "#DCDCDC", "lightgrey", "#D3D3D3", "silver", "#C0C0C0", | |
| "darkgray", "#A9A9A9", "gray", "#808080", "lightslategray", "#778899", | |
| "slategray", "#708090", "dimgray", "#696969", "darkslategray", "#2F4F4F",
| |
| "black", "#000000" | |
| ] + [
| |
| // :o
| |
| "carnationpink", "#FA7FC1"
| |
| ]; | | ]; |
| } | | } |
|
| | |
| say(key id, string str) { | | say(key id, string str) { |
| if ( USE_IMS ) llInstantMessage( id, str ); | | if (USE_IMS) |
| else llWhisper(0, str); | | llInstantMessage(id, str); |
| | else |
| | llWhisper(PUBLIC_CHANNEL, str); |
| } | | } |
|
| | |
| vector color_from_hex(string str) { | | vector color_from_hex(string str) { |
| return <(integer)("0x" + llGetSubString(str,1,2)), | | return <(integer)("0x" + llGetSubString(str,1,2)), |
Line 94: |
Line 58: |
| (integer)("0x" + llGetSubString(str,5,6))> / 255; | | (integer)("0x" + llGetSubString(str,5,6))> / 255; |
| } | | } |
|
| | |
| vector color_from_vector(string vec) { | | vector color_from_vector(string vec) { |
| // caveat: 1,1,1 will be treated as #ffffff, not #010101 | | // caveat: 1,1,1 will be treated as #ffffff, not #010101 |
| list l = llParseString2List(vec, [" ", ",", "<", ">"], []); | | list l = llParseString2List(vec, [" ", ",", "<", ">"], []); |
| vector v; | | vector v; |
|
| | |
| v.x = (float)llList2String(l, 0); | | v.x = (float)llList2String(l, 0); |
| v.y = (float)llList2String(l, 1); | | v.y = (float)llList2String(l, 1); |
| v.z = (float)llList2String(l, 2); | | v.z = (float)llList2String(l, 2); |
|
| | |
| if ( v.x > 1 || v.y > 1 || v.z > 1 ) v /= 255; | | if (v.x > 1 || v.y > 1 || v.z > 1) |
|
| | v /= 255; |
| | |
| return v; | | return v; |
| } | | } |
|
| | |
| vector color_from_name(string name) { | | vector color_from_name(string name) { |
| // vv strip spaces and force lowercase vv | | // vv strip spaces and force lowercase vv |
| integer x = llListFindList(COLORS, [ llToLower(llDumpList2String(llParseString2List(name, [" "], []), "")) ]); | | integer x = llListFindList(COLORS, [ llToLower(llDumpList2String(llParseString2List(name, [" "], []), "")) ]); |
| if ( x == -1 ) return <-1,-1,-1>; | | |
| return color_from_hex( llList2String(COLORS, x+1) ); | | if (x == -1) |
| | return <-1, -1, -1>; |
| | |
| | return color_from_hex(llList2String(COLORS, x+1)); |
| } | | } |
|
| | |
| set_color(key id, string str) { | | set_color(key id, string str) { |
| vector color; | | vector color; |
| integer i; | | integer i; |
| if ( llGetSubString(str, 0, 0) == PREFIX_HEX ) // hex code | | if (llGetSubString(str, 0, 0) == PREFIX_HEX) // hex code |
| color = color_from_hex( str ); | | color = color_from_hex(str); |
| else if ( llGetSubString(str, 0, 0) == PREFIX_VECTOR ) // vector | | else if (llGetSubString(str, 0, 0) == PREFIX_VECTOR) // vector |
| color = color_from_vector( str ); | | color = color_from_vector(str); |
| else | | else |
| color = color_from_name( str ); | | color = color_from_name(str); |
|
| | |
| if ( color.x < 0 || color.x > 1 || color.y < 0 || color.y > 1 || color.z < 0 || color.z > 1 ) { | | if (color.x < 0 || color.x > 1 || color.y < 0 || color.y > 1 || color.z < 0 || color.z > 1) { |
| say( id, "Invalid color specified: " + str ); | | say(id, "Invalid color specified: " + str); |
| return; | | return; |
| } | | } |
|
| | |
| llSetColor(color,ALL_SIDES); | | llSetColor(color, ALL_SIDES); |
| } | | } |
|
| | |
| list_colors(key id) { | | list_colors(key id) { |
| string str = ""; | | string str = ""; |
| string nstr = ""; | | string nstr = ""; |
| integer i; | | integer i; |
|
| | |
| for ( i = 0; i < llGetListLength( COLORS ); i += 2 ) { | | for (i = 0; i < llGetListLength(COLORS); i += 2) { |
| nstr = str + llList2String(COLORS, i) + ", "; | | nstr = str + llList2String(COLORS, i) + ", "; |
|
| | |
| if ( llStringLength(nstr) > MAX_CHAT_LENGTH ) { | | if (llStringLength(nstr) > MAX_CHAT_LENGTH) { |
| say(id, str); | | say(id, str); |
| str = llList2String(COLORS, i); | | str = llList2String(COLORS, i); |
Line 149: |
Line 117: |
| } | | } |
| } | | } |
| if ( str != "" ) say(id, str); | | if (str != "") say(id, str); |
| } | | } |
|
| | |
| default { | | default { |
|
| | |
| on_rez(integer bla) | | on_rez(integer bla) |
| { | | { |
Line 161: |
Line 129: |
| changed(integer change) | | changed(integer change) |
| { | | { |
| if ((OWNER_ONLY)&&(change & CHANGED_OWNER)) llResetScript(); | | if ((OWNER_ONLY) && (change & CHANGED_OWNER)) |
| | llResetScript(); |
| } | | } |
|
| | |
| state_entry() | | state_entry() |
| { | | { |
| set_colors(); | | set_colors(); |
| if (OWNER_ONLY) llListen( CHANNEL, "", llGetOwner(), "" ); | | |
| else llListen( CHANNEL, "", "", "" ); | | if (OWNER_ONLY) |
| | llListen(CHANNEL, "", llGetOwner(), ""); |
| | else |
| | llListen(CHANNEL, "", "", ""); |
| } | | } |
|
| | |
| listen(integer channel, string name, key id, string msg) { | | listen(integer channel, string name, key id, string msg) |
| | { |
| string command; | | string command; |
| string argument; | | string argument; |
| list l; | | list l; |
|
| | |
| l = llParseStringKeepNulls( msg, [" "], [] ); | | l = llParseStringKeepNulls(msg, [" "], []); |
| command = llList2String(l, 0); | | command = llList2String(l, 0); |
| argument = llDumpList2String( llList2List(l, 1, -1), " " ); | | argument = llDumpList2String(llList2List(l, 1, -1), " "); |
|
| | |
| if ( command == COMMAND_CHANGE_COLOR ) | | if (command == COMMAND_CHANGE_COLOR) |
| set_color(id, argument); | | set_color(id, argument); |
| else if ( command == COMMAND_LIST_COLORS ) | | else if (command == COMMAND_LIST_COLORS) |
| list_colors(id); | | list_colors(id); |
|
| | |
| } | | } |
| } | | } |
| </lsl>
| |
|
| |
|
| |
| == Visibone Codes ==
| |
| The above script gives you 141 options of named colors. If you'd rather use the full 216 colors of the "Web Safe" color palette, here's a code section that uses the three-letter code used by Visibone in their [http://www.visibone.com/colorlab/ Color Lab], modified so they all are three-letters long (pure colors are one or two characters in the Visibone system). Just replace the contents of the set_colors() function above with this:
| |
| <lsl>
| |
| COLORS = []; // Clear existing
| |
| COLORS += ["KKK", "#000000"]; // Black
| |
| COLORS += ["OWB", "#000033"]; // Obscure Weak Blue
| |
| COLORS += ["ODB", "#000066"]; // Obscure Dull Blue
| |
| COLORS += ["DFB", "#000099"]; // Dark Faded Blue
| |
| COLORS += ["DHB", "#0000CC"]; // Dark Hard Blue
| |
| COLORS += ["BBB", "#0000FF"]; // Blue
| |
| COLORS += ["OWG", "#003300"]; // Obscure Weak Green
| |
| COLORS += ["OWC", "#003333"]; // Obscure Weak Cyan
| |
| COLORS += ["ODA", "#003366"]; // Obscure Dull Azure
| |
| COLORS += ["DAB", "#003399"]; // Dark Azure-Blue
| |
| COLORS += ["DBA", "#0033CC"]; // Dark Blue-Azure
| |
| COLORS += ["BBA", "#0033FF"]; // Blue-Blue-Azure
| |
| COLORS += ["ODG", "#006600"]; // Obscure Dull Green
| |
| COLORS += ["ODT", "#006633"]; // Obscure Dull Teal
| |
| COLORS += ["ODC", "#006666"]; // Obscure Dull Cyan
| |
| COLORS += ["DAG", "#006699"]; // Dark Azure-Cyan
| |
| COLORS += ["DHA", "#0066CC"]; // Dark Hard Azure
| |
| COLORS += ["AAB", "#0066FF"]; // Azure-Azure-Blue
| |
| COLORS += ["DFG", "#009900"]; // Dark Faded Green
| |
| COLORS += ["DTG", "#009933"]; // Dark Teal-Grean
| |
| COLORS += ["DTC", "#009966"]; // Dark Teal-Cyan
| |
| COLORS += ["DFC", "#009999"]; // Dark Faded Cyan
| |
| COLORS += ["DCA", "#0099CC"]; // Dark Cyan-Azure
| |
| COLORS += ["AAC", "#0099FF"]; // Azure-Azure-Cyan
| |
| COLORS += ["DHG", "#00CC00"]; // Dark Hard Green
| |
| COLORS += ["DHT", "#00CC33"]; // Dark Green-Teal
| |
| COLORS += ["DHT", "#00CC66"]; // Dark Hard Teal
| |
| COLORS += ["DCT", "#00CC99"]; // Dark Cyan-Teal
| |
| COLORS += ["DHC", "#00CCCC"]; // Dark Hard Cyan
| |
| COLORS += ["CCA", "#00CCFF"]; // Cyan-Cyan-Azure
| |
| COLORS += ["GGG", "#00FF00"]; // Green
| |
| COLORS += ["GGT", "#00FF33"]; // Green-Green-Teal
| |
| COLORS += ["TTG", "#00FF66"]; // Teal-Teal-Green
| |
| COLORS += ["TTC", "#00FF99"]; // Teal-Teal-Cyan
| |
| COLORS += ["CCT", "#00FFCC"]; // Cyan-Cyan-Teal
| |
| COLORS += ["CCC", "#00FFFF"]; // Cyan
| |
| //----------------------------------------
| |
| COLORS += ["OWR", "#330000"]; // Obscure Weak Red
| |
| COLORS += ["OWM", "#330033"]; // Obscure Weak Magenta
| |
| COLORS += ["ODV", "#330066"]; // Obscure Dull Violet
| |
| COLORS += ["XXX", "#330099"]; // Dark Violet-Blue
| |
| COLORS += ["DVB", "#3300CC"]; // Dark Blue-Violet
| |
| COLORS += ["BBV", "#3300FF"]; // Blue-Blue-Violet
| |
| COLORS += ["OWY", "#333300"]; // Obscure Weak Yellow
| |
| COLORS += ["OGG", "#333333"]; // Obscure Gray
| |
| COLORS += ["DWB", "#333366"]; // Dark Weak Blue
| |
| COLORS += ["DDB", "#333399"]; // Dark Dull Blue
| |
| COLORS += ["MFB", "#3333CC"]; // Medium Faded Blue
| |
| COLORS += ["LHB", "#3333FF"]; // Light Hard Blue
| |
| COLORS += ["ODS", "#336600"]; // Obscure Dull Spring
| |
| COLORS += ["DWG", "#336633"]; // Dark Weak Green
| |
| COLORS += ["DWC", "#336666"]; // Dark Weak Cyan
| |
| COLORS += ["DDA", "#336699"]; // Dark Dull Azure
| |
| COLORS += ["MAB", "#3366CC"]; // Medium Azure-Blue
| |
| COLORS += ["LBA", "#3366FF"]; // Light Blue-Azure
| |
| COLORS += ["DSG", "#339900"]; // Dark Spring-Green
| |
| COLORS += ["DDG", "#339933"]; // Dark Dull Green
| |
| COLORS += ["DDT", "#339966"]; // Dark Dull Teal
| |
| COLORS += ["DDC", "#339999"]; // Dark Dull Cyan
| |
| COLORS += ["MAC", "#3399CC"]; // Medium Azure-Cyan
| |
| COLORS += ["LHA", "#3399FF"]; // Light Hard Azure
| |
| COLORS += ["DGS", "#33CC00"]; // Dark Green-Spring
| |
| COLORS += ["MFG", "#33CC33"]; // Medium Faded Green
| |
| COLORS += ["MTG", "#33CC66"]; // Medium Teal-Green
| |
| COLORS += ["MTC", "#33CC99"]; // Medium Teal-Cyan
| |
| COLORS += ["MFC", "#33CCCC"]; // Medium Faded Cyan
| |
| COLORS += ["LCA", "#33CCFF"]; // Light Cyan-Azure
| |
| COLORS += ["GGS", "#33FF00"]; // Green-Green-Spring
| |
| COLORS += ["LHG", "#33FF33"]; // Light Hard Green
| |
| COLORS += ["LGT", "#33FF66"]; // Light Green-Teal
| |
| COLORS += ["LHT", "#33FF99"]; // Light Hard Teal
| |
| COLORS += ["LCT", "#33FFCC"]; // Light Cyan-Teal
| |
| COLORS += ["LHC", "#33FFFF"]; // Light Hard Cyan
| |
| //----------------------------------------
| |
| COLORS += ["ODR", "#660000"]; // Obscure Dull Red
| |
| COLORS += ["ODP", "#660033"]; // Obscure Dull Pink
| |
| COLORS += ["ODM", "#660066"]; // Obscure Dull Magenta
| |
| COLORS += ["DVM", "#660099"]; // Dark Violet-Magenta
| |
| COLORS += ["DHV", "#6600CC"]; // Dark Hard Violet
| |
| COLORS += ["VVB", "#6600FF"]; // Violet-Violet-Blue
| |
| COLORS += ["ODO", "#663300"]; // Obscure Dull Orange
| |
| COLORS += ["DWR", "#663333"]; // Dark Weak Red
| |
| COLORS += ["DWM", "#663366"]; // Dark Weak Magenta
| |
| COLORS += ["DDV", "#663399"]; // Dark Dull Violet
| |
| COLORS += ["MVB", "#6633CC"]; // Medium Violet-Blue
| |
| COLORS += ["LBV", "#6633FF"]; // Light Blue-Violet
| |
| COLORS += ["ODY", "#666600"]; // Obscure Dull Yellow
| |
| COLORS += ["DWY", "#666633"]; // Dark Weak Yellow
| |
| COLORS += ["DGG", "#666666"]; // Dark Gray
| |
| COLORS += ["MWB", "#666699"]; // Medium Weak Blue
| |
| COLORS += ["LDB", "#6666CC"]; // Light Dull Blue
| |
| COLORS += ["LFB", "#6666FF"]; // Light Faded Blue
| |
| COLORS += ["DSY", "#669900"]; // Dark Spring-Yellow
| |
| COLORS += ["DDS", "#669933"]; // Dark Dull Spring
| |
| COLORS += ["MWG", "#669966"]; // Medium Weak Green
| |
| COLORS += ["MWC", "#669999"]; // Medium Weak Cyan
| |
| COLORS += ["LDA", "#6699CC"]; // Light Dull Azure
| |
| COLORS += ["LAB", "#6699FF"]; // Light Azure-Blue
| |
| COLORS += ["DHS", "#66CC00"]; // Dark Hard Spring
| |
| COLORS += ["MSG", "#66CC33"]; // Medium Spring-Green
| |
| COLORS += ["LDG", "#66CC66"]; // Light Dull Green
| |
| COLORS += ["LDT", "#66CC99"]; // Light Dull Teal
| |
| COLORS += ["LDC", "#66CCCC"]; // Light Dull Cyan
| |
| COLORS += ["LAC", "#66CCFF"]; // Light Azure-Cyan
| |
| COLORS += ["SSG", "#66FF00"]; // Spring-Spring Green
| |
| COLORS += ["LGS", "#66FF33"]; // Light Green-Spring
| |
| COLORS += ["LFG", "#66FF66"]; // Light Faded Green
| |
| COLORS += ["LTG", "#66FF99"]; // Light Teal-Green
| |
| COLORS += ["LTC", "#66FFCC"]; // Light Teal-Cyan
| |
| COLORS += ["LFC", "#66FFFF"]; // Light Faded Cyan
| |
| //----------------------------------------
| |
| COLORS += ["DFG", "#990000"]; // Dark Faded Red
| |
| COLORS += ["DPR", "#990033"]; // Dark Pink-Red
| |
| COLORS += ["DPM", "#990066"]; // Dark Pink-Magenta
| |
| COLORS += ["DFM", "#990099"]; // Dark Faded Magenta
| |
| COLORS += ["DMV", "#9900CC"]; // Dark Magenta-Violet
| |
| COLORS += ["VVM", "#9900FF"]; // Violet-Violet-Magenta
| |
| COLORS += ["DOR", "#993300"]; // Dark Orange-Red
| |
| COLORS += ["DDR", "#993333"]; // Dark Dull Red
| |
| COLORS += ["DDP", "#993366"]; // Dark Dull Pink
| |
| COLORS += ["DDM", "#993399"]; // Dark Dull Magenta
| |
| COLORS += ["MVM", "#9933CC"]; // Medium Violet-Magenta
| |
| COLORS += ["LHV", "#9933FF"]; // Light Hard Violet
| |
| COLORS += ["DOY", "#996600"]; // Dark Orange-Yellow
| |
| COLORS += ["DDO", "#996633"]; // Dark Dull Orange
| |
| COLORS += ["MWR", "#996666"]; // Medium Weak Red
| |
| COLORS += ["MWM", "#996699"]; // Medium Weak Magenta
| |
| COLORS += ["LDV", "#9966CC"]; // Light Dull Violet
| |
| COLORS += ["LVB", "#9966FF"]; // Light Violet-Blue
| |
| COLORS += ["DFY", "#999900"]; // Dark Faded Yellow
| |
| COLORS += ["DDY", "#999933"]; // Dark Dull Yellow
| |
| COLORS += ["MWY", "#999966"]; // Medium Weak Yellow
| |
| COLORS += ["LGG", "#999999"]; // Light Gray
| |
| COLORS += ["LWB", "#9999CC"]; // Light Weak Blue
| |
| COLORS += ["PDB", "#9999FF"]; // Pale Dull Blue
| |
| COLORS += ["DYS", "#99CC00"]; // Dark Yellow-Spring
| |
| COLORS += ["DYS", "#99CC33"]; // Medium Spring-Yellow
| |
| COLORS += ["LDS", "#99CC66"]; // Light Dull Spring
| |
| COLORS += ["LWG", "#99CC99"]; // Light Weak Green
| |
| COLORS += ["LWC", "#99CCCC"]; // Light Weak Cyan
| |
| COLORS += ["PDA", "#99CCFF"]; // Pale Dull Azure
| |
| COLORS += ["SSY", "#99FF00"]; // Spring-Spring Yellow
| |
| COLORS += ["LHS", "#99FF33"]; // Light Hard Spring
| |
| COLORS += ["LSG", "#99FF66"]; // Light Spring-Green
| |
| COLORS += ["PDG", "#99FF99"]; // Pale Dull Green
| |
| COLORS += ["PDT", "#99FFCC"]; // Pale Dull Teal
| |
| COLORS += ["PDC", "#99FFFF"]; // Pale Dull Cyan
| |
| //----------------------------------------
| |
| COLORS += ["DHR", "#CC0000"]; // Dark Hard Red
| |
| COLORS += ["DRP", "#CC0033"]; // Dark Red-Pink
| |
| COLORS += ["DHP", "#CC0066"]; // Dark Hard Pink
| |
| COLORS += ["DMP", "#CC0099"]; // Dark Magenta-Pink
| |
| COLORS += ["DHM", "#CC00CC"]; // Dark Hard Magenta
| |
| COLORS += ["MMV", "#CC00FF"]; // Magenta-Magenta Violet
| |
| COLORS += ["DRO", "#CC3300"]; // Dark Red-Orange
| |
| COLORS += ["MFR", "#CC3333"]; // Medium Faded Red
| |
| COLORS += ["MPR", "#CC3366"]; // Medium Pink-Red
| |
| COLORS += ["MPM", "#CC3399"]; // Medium Pink-Magenta
| |
| COLORS += ["MFM", "#CC33CC"]; // Medium Faded Magenta
| |
| COLORS += ["LMV", "#CC33FF"]; // Light Magenta-Violet
| |
| COLORS += ["DHO", "#CC6600"]; // Dark Hard Orange
| |
| COLORS += ["MOR", "#CC6633"]; // Medium Orange-Red
| |
| COLORS += ["LDR", "#CC6666"]; // Light Dull Red
| |
| COLORS += ["LDP", "#CC6699"]; // Light Dull Pink
| |
| COLORS += ["LDM", "#CC66CC"]; // Light Dull Magenta
| |
| COLORS += ["LVM", "#CC66FF"]; // Light Violet-Magenta
| |
| COLORS += ["DYO", "#CC9900"]; // Dark Yellow-Orange
| |
| COLORS += ["MOY", "#CC9933"]; // Medium Orange-Yellow
| |
| COLORS += ["LDO", "#CC9966"]; // Light Dull Orange
| |
| COLORS += ["LWR", "#CC9999"]; // Light Weak Red
| |
| COLORS += ["LWM", "#CC99CC"]; // Light Weak Magenta
| |
| COLORS += ["PDV", "#CC99FF"]; // Pale Dull Violet
| |
| COLORS += ["DHY", "#CCCC00"]; // Dark Hard Yellow
| |
| COLORS += ["MFY", "#CCCC33"]; // Medium Faded Yellow
| |
| COLORS += ["LDY", "#CCCC66"]; // Light Dull Yellow
| |
| COLORS += ["LWY", "#CCCC99"]; // Light Weak Yellow
| |
| COLORS += ["PGG", "#CCCCCC"]; // Pale Gray
| |
| COLORS += ["PWB", "#CCCCFF"]; // Pale Weak Blue
| |
| COLORS += ["YYS", "#CCFF00"]; // Yellow-Yellow Spring
| |
| COLORS += ["LYS", "#CCFF33"]; // Light Yellow-Spring
| |
| COLORS += ["LSY", "#CCFF66"]; // Light Spring-Yellow
| |
| COLORS += ["PDS", "#CCFF99"]; // Pale Dull Spring
| |
| COLORS += ["PWG", "#CCFFCC"]; // Pale Weak Green
| |
| COLORS += ["PWC", "#CCFFFF"]; // Pale Weak Cyan
| |
| //----------------------------------------
| |
| COLORS += ["RRR", "#FF0000"]; // Red
| |
| COLORS += ["RRP", "#FF0033"]; // Red-Red-Pink
| |
| COLORS += ["PPR", "#FF0066"]; // Pink-Pink-Red
| |
| COLORS += ["PPM", "#FF0099"]; // Pink-Pink-Magenta
| |
| COLORS += ["MMP", "#FF00CC"]; // Magenta-Magenta-Pink
| |
| COLORS += ["MMM", "#FF00FF"]; // Magenta
| |
| COLORS += ["RRO", "#FF3300"]; // Red-Red-Orange
| |
| COLORS += ["LHR", "#FF3333"]; // Light Hard Red
| |
| COLORS += ["LRP", "#FF3366"]; // Light Red-Pink
| |
| COLORS += ["LHP", "#FF3399"]; // Light Hard Pink
| |
| COLORS += ["LMP", "#FF33CC"]; // Light Magenta-Pink
| |
| COLORS += ["LHM", "#FF33FF"]; // Light Hard Magenta
| |
| COLORS += ["OOR", "#FF6600"]; // Orange-Orange-Red
| |
| COLORS += ["LRO", "#FF6633"]; // Light Red-Orange
| |
| COLORS += ["LFR", "#FF6666"]; // Light Faded Red
| |
| COLORS += ["LPR", "#FF6699"]; // Light Pink-Red
| |
| COLORS += ["LPM", "#FF66CC"]; // Light Pink-Magenta
| |
| COLORS += ["LFM", "#FF66FF"]; // Light Faded Magenta
| |
| COLORS += ["OOY", "#FF9900"]; // Orange-Orange-Yellow
| |
| COLORS += ["LHO", "#FF9933"]; // Light Hard Orange
| |
| COLORS += ["LOR", "#FF9966"]; // Light Orange-Red
| |
| COLORS += ["PDR", "#FF9999"]; // Pale Dull Red
| |
| COLORS += ["PDP", "#FF99CC"]; // Pale Dull Pink
| |
| COLORS += ["PDM", "#FF99FF"]; // Pale Dull Magenta
| |
| COLORS += ["YYO", "#FFCC00"]; // Yellow-Yellow-Orange
| |
| COLORS += ["LYO", "#FFCC33"]; // Light Yellow-Orange
| |
| COLORS += ["LOY", "#FFCC66"]; // Light Orange-Yellow
| |
| COLORS += ["PDO", "#FFCC99"]; // Pale Dull Orange
| |
| COLORS += ["PWR", "#FFCCCC"]; // Pale Weak Red
| |
| COLORS += ["PWM", "#FFCCFF"]; // Pale Weak Magenta
| |
| COLORS += ["YYY", "#FFFF00"]; // Yellow
| |
| COLORS += ["LHY", "#FFFF33"]; // Light Hard Yellow
| |
| COLORS += ["LFY", "#FFFF66"]; // Light Faded Yellow
| |
| COLORS += ["PDY", "#FFFF99"]; // Pale Dull Yellow
| |
| COLORS += ["PWY", "#FFFFCC"]; // Pale Weak Yellow
| |
| COLORS += ["WWW", "#FFFFFF"]; // White
| |
| </lsl> | | </lsl> |
Color script
Compare:
Color lists:
<lsl>
// Created by: Masakazu Kojima
// Reposted by: ALicia Sautereau
integer CHANNEL = PUBLIC_CHANNEL; // channel to listen for commands on
integer OWNER_ONLY = FALSE; // only owner can control
integer USE_IMS = TRUE; // send IMs instead of using chat
string COMMAND_CHANGE_COLOR = "change"; // command to change color
string COMMAND_LIST_COLORS = "listcolors"; // command to list colors
integer MAX_CHAT_LENGTH = 255; // max size for one message
string PREFIX_HEX = "#"; // prefix to specify hex code
string PREFIX_VECTOR = "<"; // prefix to specify vector code
list LINKS_TO_SET = [LINK_SET, ALL_SIDES]; // [link number, link face, ...]
list COLORS;
set_colors() {
COLORS = [
"navy", "#001f3f",
"blue", "#0074d9",
"aqua", "#7fdbff",
"teal", "#39cccc",
"olive", "#3d9970",
"green", "#2ecc40",
"lime", "#01ff70",
"yellow", "#ffdc00",
"orange", "#ff851b",
"red", "#ff4136",
"maroon", "#85144b",
"fuchsia", "#f012be",
"purple", "#b10dc9",
"white", "#ffffff",
"silver", "#dddddd",
"gray", "#aaaaaa",
"black", "#111111"
];
}
say(key id, string str) {
if (USE_IMS)
llInstantMessage(id, str);
else
llWhisper(PUBLIC_CHANNEL, str);
}
vector color_from_hex(string str) {
return <(integer)("0x" + llGetSubString(str,1,2)),
(integer)("0x" + llGetSubString(str,3,4)),
(integer)("0x" + llGetSubString(str,5,6))> / 255;
}
vector color_from_vector(string vec) {
// caveat: 1,1,1 will be treated as #ffffff, not #010101
list l = llParseString2List(vec, [" ", ",", "<", ">"], []);
vector v;
v.x = (float)llList2String(l, 0);
v.y = (float)llList2String(l, 1);
v.z = (float)llList2String(l, 2);
if (v.x > 1 || v.y > 1 || v.z > 1)
v /= 255;
return v;
}
vector color_from_name(string name) {
// vv strip spaces and force lowercase vv
integer x = llListFindList(COLORS, [ llToLower(llDumpList2String(llParseString2List(name, [" "], []), "")) ]);
if (x == -1)
return <-1, -1, -1>;
return color_from_hex(llList2String(COLORS, x+1));
}
set_color(key id, string str) {
vector color;
integer i;
if (llGetSubString(str, 0, 0) == PREFIX_HEX) // hex code
color = color_from_hex(str);
else if (llGetSubString(str, 0, 0) == PREFIX_VECTOR) // vector
color = color_from_vector(str);
else
color = color_from_name(str);
if (color.x < 0 || color.x > 1 || color.y < 0 || color.y > 1 || color.z < 0 || color.z > 1) {
say(id, "Invalid color specified: " + str);
return;
}
llSetColor(color, ALL_SIDES);
}
list_colors(key id) {
string str = "";
string nstr = "";
integer i;
for (i = 0; i < llGetListLength(COLORS); i += 2) {
nstr = str + llList2String(COLORS, i) + ", ";
if (llStringLength(nstr) > MAX_CHAT_LENGTH) {
say(id, str);
str = llList2String(COLORS, i);
} else {
str = nstr;
}
}
if (str != "") say(id, str);
}
default {
on_rez(integer bla)
{
llResetScript();
}
changed(integer change)
{
if ((OWNER_ONLY) && (change & CHANGED_OWNER))
llResetScript();
}
state_entry()
{
set_colors();
if (OWNER_ONLY)
llListen(CHANNEL, "", llGetOwner(), "");
else
llListen(CHANNEL, "", "", "");
}
listen(integer channel, string name, key id, string msg)
{
string command;
string argument;
list l;
l = llParseStringKeepNulls(msg, [" "], []);
command = llList2String(l, 0);
argument = llDumpList2String(llList2List(l, 1, -1), " ");
if (command == COMMAND_CHANGE_COLOR)
set_color(id, argument);
else if (command == COMMAND_LIST_COLORS)
list_colors(id);
}
}
</lsl>