kallookoo / wp-color-picker-alpha

Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
GNU General Public License v2.0
132 stars 88 forks source link

Alpha channel is not showing #57

Open LuigiCaradonna opened 2 weeks ago

LuigiCaradonna commented 2 weeks ago

I have set an input field as follows

<input type="text" class="color-picker" data-alpha-enabled="true" name="kam_bg_color" value="rgba(0,0,0,0.6)"/>

The picker shows up and I can use it, but the slider for the alpha channel does not appear.

Tried on Firerox 129.0.2 (64 bit) and Brave 1.69.160, both for Windows.

kallookoo commented 1 week ago

Hello,

Could you share how you include the javascript file and the javascript code to create the color picker.

From what you say, it seems that what happens to you is because of what I said before.

LuigiCaradonna commented 1 week ago

This is what I do

wp_register_script( 
    'wp-color-picker-alpha', 
    PLUGIN_URL . 'assets/js/wp-color-picker-alpha.min.js', 
    array( 'wp-color-picker' ), 
    '3.0.4', 
    true 
);
wp_add_inline_script(
    'wp-color-picker-alpha',
    'jQuery( function() { jQuery( ".color-picker" ).wpColorPicker(); } );'
);
wp_enqueue_script( 'wp-color-picker-alpha' );
<input type="text" class="color-picker" data-alpha-enabled="true" name="kam_bg_color" value="rgba(0,0,0,0.6)"/>
kallookoo commented 6 days ago

Sorry, but from what you say you must have some kind of error that is not related to the script. Also I see that you do not include the CSS and use a constant so it could be the cause or that someone loads the wp-color-picker and is giving problems.