Home Forums Front-end Issues Display color name with color picker Reply To: Display color name with color picker

  • Hi @mikealkeal

    The library you have linked is used for JS, so you need to get the name and apply it using JS too. Here’s an example how you can integrate PHP code and JS script:

    <script type="text/javascript">
      var n_match  ="<?php the_field('color_field_name') ?>");
      n_rgb        = n_match[0]; // RGB value of closest match
      n_name       = n_match[1]; // Text string: Color name
      n_exactmatch = n_match[2]; // True if exact color match

    If you want to do it using PHP code, kindly check this thread:

    I hope this helps 🙂