I didn't realize tinycolor had an equals function. In that case, you don't have to convert both colors to a Rgb(a)string. You should be able to just pass in the form field value and the default value.