WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a wordpress theme and in that I am using the theme customizer to allow users to change the accent color of my theme. Now everything is working fine but few of my elements need to have the color in rgba() and not hexadecimal.

I've searched around and found that there is no way to make the customizer color picker work with rgba(), but I've seen many themes allow that and would like to know how I can do it too, but I just kind a solution anywhere.

Please let me know if you know how to do this. Thank you very much and best regards.

This is the part of my code in which I assign the value I get from the color picker to the anchor tag.

wp.customize( 'tcx_link_color', function( value ) {
    value.bind( function( to ) {
        $( 'a' ).css( 'color', to );
    } );
share|improve this question
This might be what you're looking for: How to add a Color Control with Alpha/Opacity to the WordPress Theme Customizer ...worked a treat for me! – markmoxx Apr 15 '15 at 17:39

Why exactly you want to represent it in RGBA where A means alpha channel (I guess)

I mean, hex does not support transparency, so if you want to convert it to RGB, you just need to convert from hex to decimal

r = parseInt(hex.substring(0,2), 16);
g = parseInt(hex.substring(2,4), 16);
b = parseInt(hex.substring(4,6), 16);
result = 'rgba('+r+','+g+','+b+','+1+')';

taken from http://jsfiddle.net/ekinertac/3Evx5/1/

this just converts every hex digit to decimal value.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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