It just literally offsets the colour.
else if (!stricmp_utf8_ex(p_name,p_name_length,"offset_colour",infinite))
{
if (p_params->get_param_count() == 3)
{
const char * p_val, * p_val2;
unsigned p_val_length, p_val2_length;
p_params->get_param(0,p_val,p_val_length);
int colour = strtoul_n(p_val, p_val_length);
p_params->get_param(1,p_val2,p_val2_length);
int target = strtoul_n(p_val2, p_val2_length);
int amount = p_params->get_param_uint(2);
int rdiff = (target & 0xff) - (colour & 0xff);
int gdiff = ((target & 0xff00)>>8) - ((colour & 0xff00)>>8);
int bdiff = ((target & 0xff0000)>>16) - ((colour & 0xff0000)>>16);
int totaldiff = abs(rdiff + gdiff + bdiff);
int newr = (colour & 0xff) + (totaldiff ? (rdiff * amount*3 / totaldiff) : 0);
if (newr < 0) newr = 0;
if (newr > 255) newr = 255;
int newg = ((colour & 0xff00)>>8) + (totaldiff ? (gdiff * amount*3 / totaldiff) : 0);
if (newg < 0) newg = 0;
if (newg > 255) newg = 255;
int newb = ((colour & 0xff0000)>>16) + (totaldiff ? (bdiff * amount*3 / totaldiff) : 0);
if (newb < 0) newb = 0;
if (newb > 255) newb = 255;
int newrgb = RGB(newr,newg,newb);
char temp[33];
memset(temp, 0, 33);
ultoa(newrgb, temp, 16);
p_out->write(titleformat_inputtypes::unknown, temp, 33);
p_found_flag = true;
return true;
}
}
where strtoul_n is my own function but I figure you don't need it