color-distance math slightly off. Go through ScriptManager code to get the correct math and update the equations accordingl