I’ve had this issue before, and I think there’s one solution.
Have a text box that you type in, and a text label that shows the actual color. Set the text label’s text to the text box’s text every time it changes.
I already thought of this but then had to consider when someone would highlight the text. Since the label is over the box, it would show as if nothing was selected.