I believe this function already exists in color_utils.js