I am building a web CMS in which the user can choose colours for certain site elements. I would like to convert all colour values to hex to avoid any further formatting hass
The alpha channel defines the transparency value of a color, so any color is 100% transparent as long as the alpha value is 0. Typically this four-channel color type is known as RGBA.
You can specify RGBA in CSS like so:
div {
background: rgba(200, 54, 54, 0.5); /* 50% transparent */
}
Note that not all browsers support RGBA, in which case you can specify a fallback:
div {
background: rgb(200, 54, 54); /* fallback */
background: rgba(200, 54, 54, 0.5); /* 50% transparent */
}
More information regarding browser support and workarounds can be found here.