Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Scripted by iMagic
- // Mode 0 gets you the index of a color from it's name as a string
- // e.g. onGetColor(0, "honeydew") would return 78
- // Mode 1 gets you the name of a color as a string from it's index
- // e.g. onGetColor(1, 78) would return "honeydew"
- function onGetColor(mode, value) {
- temp.color_list = {
- {"aliceblue",20},{"antiquewhite",21},{"aqua",22},{"aquamarine",23},{"azure",24},{"beige",25},{"bisque",26},{"black",18},{"blanchedalmond",28},{"blueviolet",20},{"burlywood",32},{"cadetblue",33},{"chartreuse",34},{"chocolate",35},{"coral",36},{"cornflowerblue",37},
- {"cornsilk",32},{"crimson",39},{"cyan",40},{"darkcyan",42},{"darkgoldenrod",43},{"darkgray",44},{"darkkhaki",47},{"darkmagenta",48},{"darkolivegreen",49},{"darkorange",50},{"darkorchid",51},{"darksalmon",53},{"darkseagreen",43},{"darkslateblue",55},
- {"darkslategray",56},{"darkturquoise",58},{"darkviolet",59},{"deeppink",60},{"deepskyblue",61},{"dimgray",62},{"dodgerblue",64},{"feldspar",65},{"firebrick",66},{"floralwhite",67},{"forestgreen",68},{"fuchsia",69},{"gainsboro",70},{"ghostwhite",71},
- {"gold",71},{"goldenrod",72},{"greenyellow",76},{"honeydew",78},{"hotpink",79},{"indianred",80},{"indigo",81},{"ivory",82},{"khaki",83},{"lavenderblush",85},{"lavender",84},{"lawngreen",86},{"lemonchiffon",87},{"lightcoral",89},{"lightcyan",90},
- {"lightgoldenrodyellow",91},{"lightpink",95},{"lightsalmon",96},{"lightseagreen",97},{"lightskyblue",98},{"lightslateblue",99},{"lightslategray",100},{"lightsteelblue",102},{"lightyellow",103},{"lime",104},{"linen",106},{"magenta",107},{"maroon",108},
- {"mediumaquamarine",109},{"mediumblue",110},{"mediumorchid",111},{"mediumpurple",112},{"mediumseagreen",113},{"mediumslateblue",114},{"mediumspringgreen",115},{"mediumturquoise",116},{"mediumvioletred",117},{"midnightblue",118},{"mintcream",119},
- {"mistyrose",120},{"moccasin",121},{"navajowhite",122},{"navy",123},{"oldlace",124},{"olive",125},{"olivedrab",126},{"orange",2},{"orangered",128},{"orchid",129},{"palegoldenrod",130},{"palegreen",131},{"paleturquoise",132},{"palevioletred",133},{"papayawhip",134},{"peachpuff",135},
- {"peru",136},{"plum",138},{"powderblue",139},{"rosybrown",142},{"royalblue",143},{"saddlebrown",144},{"salmon",145},{"sandybrown",146},{"seagreen",147},{"seashell",148},{"sienna",149},{"silver",150},{"skyblue",151},{"slateblue",152},{"slategray",153},{"snow",155},{"steelblue",157},
- {"tan",158},{"teal",159},{"thistle",160},{"tomato",161},{"turquoise",162},{"violet",163},{"violetred",164},{"wheat",165},{"whitesmoke",167},{"yellowgreen",169}
- };
- switch (temp.mode) {
- case 1:
- for (temp.i = 0; temp.i <= temp.color_list.size(); temp.i++) {
- if (temp.value == temp.color_list[temp.i][1]) {
- temp.color = temp.color_list[temp.i][0];
- break;
- }
- } return temp.color;
- break;
- case 0:
- for (temp.i = 0; temp.i <= temp.color_list.size(); temp.i++) {
- if (temp.value == temp.color_list[temp.i][0]) {
- temp.color = temp.color_list[temp.i][1];
- break;
- }
- } return temp.color;
- break;
- }
- }
Add Comment
Please, Sign In to add comment