addClass() does not add class

addClass() does not add class

In my css i have the following classes:

.orange {
        background-color: orange;
    }

    .coral {
        background-color: coral;
    }


    .brick {
        color: firebrick;
    }

    .indian {
        color: indianred;
    }


    .pinky {
        color: pink;
    }


    .purple {
        color: RGB(102, 51, 153);
        font-weight: bold;
    }



when i use them like this, they work:

$('h1').addClass('blue');
$('h2').addClass('red');
$('h3').addClass('yellow pinky');
$('h4').addClass('orange indian');
$('h5').addClass('coral');


but when i do this, the addClass method doesn't work.  Why doesn't it work here?:
$('h1').before('<p>tootsy</p>').addClass('purple');

However if i do this, it works:
$('h1').before('<p class="purple">tootsy</p>');