{
int h,s,l, t,c,x,m, r,g,b;
- int n = str_hash(str);
+ unsigned int n = str_hash(str);
h = (n / 0x1) % 0x100; // 0..256
s = (n / 0x100) % 0x100; // 0..256
s = s / 0x4 + 0xC0; // 0..256
switch (theme) {
- case THEME_NORMAL: l = l / 0x4 + 0x80; break;
- case THEME_DARK: l = l / 0x4 + 0x30; break;
- case THEME_LIGHT: l = l / 0x4 + 0x60; break;
+ case THEME_DARK: l = l / 0x4 + 0x80; break;
+ case THEME_LIGHT: l = l / 0x4 + 0x30; break;
+ case THEME_NORMAL: l = l / 0x4 + 0x60; break;
}
t = h / 60; // ,1,2,3,4,5
//debug("%12s %3d,%02x,%02x -> "
// "tcxm=%d,%02x,%02x,%02x -> "
// "rgb=%02x,%02x,%02x -> %d",
- // name, h,s,l, t,c,x,m, r,g,b, x);
+ // str, h,s,l, t,c,x,m, r,g,b, x);
return color(x, -1);
}
else if (match(text, "/sort")) {
qsort(messages, history, sizeof(message_t), msg_compare);
}
+ else if (prefix(text, "/theme", &arg)) {
+ for (int i = 0; i < N_ELEMENTS(themes); i++)
+ if (match(themes[i], arg))
+ theme = i;
+ }
else if (prefix(text, "/open", &arg)) {
if (!arg && focus)
arg = focus->channel->name;
if (focus->filter)
regcomp(&focus->regex, focus->filter, RE_FLAGS);
}
- else if (focus) {
+ else if (focus && focus->channel) {
chat_send(focus->channel, text);
}
else {