Hướng dẫn php hex to rgb
As far as we know, many of WordPress theme developers use a lot of design options inside their themes, just as we do. Which means that you usually provide color pickers so the users may easily change color settings for their websites. This usually means that you will need to create dynamic CSS files instead of a hard-coded CSS, so the user’s color changes may apply on the website instantly. As for HTML5/CSS3 standards, hex colors can’t always do all the work so you need to work with RGB or RGBA color codes. While we have been struggling with this sometimes, we have made a little PHP helper function which converts hex color code string into RGB or even RGBA color. For example, if you want to add opacity to the color of some element and basically achieve “transparent hex code”. Top Hosting recommended by Meks Convert hex color to rgba – PHP functionHere’s the code:
So far so good! Now we are going to show you how this function can be helpful whilst creating dynamic CSS with a simple example below. Usage example:
|