Struppi: Help- if bedinung

Beitrag lesen

if(rot < 0)
        var tmprot = Math.max(0, (rot-minus)).toString(16);
    if(rot > 255)
        var tmprot = Math.min(255, (rot-minus)).toString(16);
    if(rot <= 255 && rot >= 0)
        var tmprot = (rot-minus).toString(16);
    var count = tmprot.toString();
    if(count.length<2)
        var tmprot = "0" + tmprot;

Das sieht ja so aus, als ob du aus dezimalen RGB Werten Heaxadezimale machen willst. Nur was dieses - minus bedeutet ist unklar, zu ziehst noch einen Wert ab, aber was für einen?

Vor allem sind deine if Bedingungen doppelt gemoppelt.

if( x > 255) x = Math.min(x, 255);

Das ist Blödsinn, enweder nur:
if( x > 255) x = 255;
oder
x = Math.min(x, 255);

Struppi.