1

React client is sending color to my server with this format {"r":1 "g":8 "b":5 "a":2}, for instance.

I'm not sure what is the best way to record color in MySQL.

I don't want to use this data in server. Just I want to send it to the client with the same format.

  • Further to the first comment, how are you filtering/joining/sorting/grouping by r,g,b values? Are you doing maths operations on them? – danblack Nov 14 '18 at 21:29
3

If "you want to send it to the client with the same format", then it is reasonable to treat it as "opaque".

That is, store it as a string with no meaning or structure that you care about. And it does not matter (within limits) what datatype you use. VARCHAR(99), TEXT, BLOB -- any of these would suffice.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.