Home › Forums › Feature Requests › Color Picker values › Reply To: Color Picker values
I’ve used the following workaround (in this specific example I was forming it for use echoed as inline CSS):
– 2 fields, one the colour picker and the other for a number for opacity (0 to 1 in 0.1 increments)
– In PHP convert the hex colour value to an RGB and then tack the opacity value on the end, like so:
list($r, $g, $b) = sscanf($colour_field_value, "#%02x%02x%02x");
$rgba_colour = 'rgba(' . $r . ',' . $g . ',' . $b . ',' . $opacity_field_value .')';
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.