yuzu yuzu - 8 months ago 24
CSS Question

How to write css for a color when you only know the color in the RGB format

I changed the title so that it will be more clear in the difference from the duplicate questions.

Let me explain how this question is different from RGB to Hex and Hex to RGB
The previous question is for the general purpose. However this question is only for uses in css. Please understand that many of the readers of this question do not understand the answers of the previous question. Me too.

I know this question seems to duplicate to How to convert RGB to HTML color?.

However I think the answer tries to teach more than the original question. In fact, I don't understand the answer and can't use it in the actual code.

Please give me the simplest mathematical formula to translate RGB to the form like #fff which I think represents white.

I know the required color is written as R:63,G:81,B:181 in RGB.

R:63, G:81, B:181

And I need to translate the RGB into the CSS format.
Please give me exact CSS color code for the color. Plus please give me the simplest mathematical formula for the translation.


if the rgb in decimal is the only information you have, you don't need to transfer, simply put

color: rgb(61, 81, 181)