pike.git / lib / modules / Colors.pmod

version» Context lines:

pike.git/lib/modules/Colors.pmod:542: Inside #if defined(ROXEN)
   from = lower_case(from-" ");   #ifdef ROXEN    if(html_32_colors[from]) from = html_32_colors[from];    else   #endif    if(arrayp(this_object()[from])) return this_object()[from];       // Is it #rrggbb?    if(from[0]=='#')    { -  c = (int)("0x"+from[1..]); +  sscanf(from, "#%x", c);    if(strlen(from)>6)    return ({ c>>16, (c>>8)&255, c&255 });    return ({ (c>>8)<<4, ((c>>4)&15)<<4, (c&15)<<4 });    } else if(from[0]=='@') {    // Nope. What about @h,s,v? (h=degrees, 0 to 359, s and v = percent)    float h, s, v;    float r, g, b;    sscanf(from[1..], "%d,%d,%d", h, s, v);    h = (h/360.0) * 2*3.1415; s=(s/100.0); v=(v/100.0);    r=v+s*cos(h);
pike.git/lib/modules/Colors.pmod:570:    sscanf(from[1..], "%d,%d,%d,%d", c, m, y, k);    int r=100, b=100, g=100;    r-=c+k; g-=m+k; b-=y+k;    if(r<0) r=0;    if(g<0) g=0;    if(b<0) b=0;    return ({ (int)(r*2.55), (int)(g*2.55), (int)(b*2.55) });    }       // No luck. It might be a color on the form rrggbb (that is, no leading '#') -  if(c=(int)("0x"+from)) +  sscanf(from, "%x", c); +  if(c)    {    if(strlen(from)>5)    return ({ c>>16, (c>>8)&255, c&255 });    return ({ (c>>8)<<4, ((c>>4)&15)<<4, (c&15)<<4 });    }       from = replace(from-" ", "gray", "grey");       // Perhaps it is a greyscale? (gray00 to gray99)    if(sscanf(from, "grey%d", c))