Okay
  Public Ticket #2485230
Changing Iris Palette
Closed

Comments

  • betterts started the conversation

    Hi there,

    I'm trying to override the default Iris palette to match my theme's colors, since salient palette only extends to certain parts of the theme. However, this is creating a visual issue. Could you help shed light on why?

    What I'm adding:

    function new_iris_palette() {
    ?>
        <script>
            jQuery(document).ready(function($){
                $.wp.wpColorPicker.prototype.options = {
                    palettes: ['#ffffff', '#000000','#ff0', '#0ff', '#f0f', '#0f0', '#00f', '#f00']
                };
            });
        </script>
    <?php
    }
    add_action('admin_print_footer_scripts', 'new_iris_palette');
    add_action('customize_controls_print_footer_scripts', 'new_iris_palette');

    Attached

    • Before.png: Salient Default
    • After.png: New custom palette
    • Code-before.png: The salient default palette html
    • Code-after.png: The modified palette html

    I'm assuming that I'm overriding some Salient styling somewhere. Could you help me modify my function so that the styling matches? Thank you!

  •  1,085
    ThemeNectar replied

    Hey betterts,

    Try to change the snippet to the following:

    function new_iris_palette() {
    ?>
        <script>
            jQuery(document).ready(function($){
                $.wp.wpColorPicker.prototype.options.palettes = ['#ffc1c1', '#000000','#ff0', '#0ff', '#f0f', '#0f0', '#00f', '#f00'];
            });
        </script>
    <?php
    }
    add_action('admin_print_footer_scripts', 'new_iris_palette');
    add_action('customize_controls_print_footer_scripts', 'new_iris_palette');-->
    

    Cheers

  • betterts replied

    Worked perfectly, thank you!