In Photoshop, if you select a text layer, and then right-click the menu and select "Copy CSS", then the color is copied in rgb format.
Tell me how to set up Photoshop so that the color is copied to hex?
Most likely there is no such option. You can try this plugin:
I myself have not tried it, but judging by the generated code, the color is in hex format (if there is no transparency).