Thank you for the responses. After a couple more hours of head banging, I found I had an old addon in my code folder. I have no idea when or where I got it, but it's exactly what I wanted to mess with. When first learning lua, working with 100 lines of code is far more manageable than 3600+ lines. ;)
Since the code in the second addon is much simpler, it was a simple matter of just doing the following:
newLine = QualityID:Color(newLine, rarity)
function QualityID:Color(text, rarity)
local _, _, _, hex = GetItemQualityColor(rarity)
return tostring(hex) .. tostring(text) .. "|r"