Customising Wordpress Color Picker

后端 未结 4 1039
执笔经年
执笔经年 2021-02-06 14:38

Is there any way to customize the Wordpress 3.8 color picker (on the custom field types) to use only colors i will define?

I need to have only 6 colors for a client, bu

4条回答
  •  无人共我
    2021-02-06 15:22

    Here's a quick & dirty solution:

    1. Go to wp-admin/js/iris.min.js
    2. Search the palette colors there (about 1/3 from the beginning of the file). I found this:
      _palettes:["#000","#fff","#d33","#d93","#ee2","#81d742","#1e73be","#8224e3"]
    3. Replace these defaults with your own custom colors. I left black and white and then added our brand colors instead of #d33 and the rest.
    4. Upload to server.

    Works for now. But haven't tried yet if this survives the next Wordpress update.

提交回复
热议问题