• Resolved jeffatrmc

    (@jeffatrmc)


    Hello @mr.clayton

    Is there any way to darken the input fields for credit cards and other payment methods that use site-based input fields? We have had some complaints about a lack of contrast from our white background. Let me know if this is possible not a huge deal if it is not.

    Best,
    Jeff

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @jeffatrmc,

    Yes this is possible. You can use the wc_stripe_cc_element_style filter to alter the styling of either the Stripe form or the custom forms.

    API Docs

    The text color property is base.color.

    Kind Regards,

    Thread Starter jeffatrmc

    (@jeffatrmc)

    Hi @mrclayton

    This is awesome. However, I am not the greatest at writing PHP. Copy and pasting the code below didn’t seem to implement in my child theme functions.php file. Am I placing it in the wrong file or do I need to change some parameters outside of the color values to have this implement?

    private function get_form_style() {
            if ( $this->is_custom_form_active() ) {
                $style = $this->get_custom_form()['elementStyles'];
            } else {
                $style = array(
                    'base'    => array(
                        'color'         => '#32325d',
                        'fontFamily'    => '"Helvetica Neue", Helvetica, sans-serif',
                        'fontSmoothing' => 'antialiased',
                        'fontSize'      => '18px',
                        '::placeholder' => array( 'color' => '#aab7c4' ),
                        ':focus'        => array(),
                    ),
                    'invalid' => array(
                        'color'     => '#fa755a',
                        'iconColor' => '#fa755a',
                    ),
                );
            }
    
            return apply_filters( 'wc_stripe_cc_element_style', $style );
        }

    Let me know and I appreciate the help in advance.

    Best,
    Jeff

    Plugin Author Payment Plugins

    (@mrclayton)

    @jeffatrmc you shouldn’t copy and paste the code, you should use the filter to add your custom code which changes the color of the text.

    add_filter('wc_stripe_cc_element_style', function($styles){
        $style['base']['color'] = 'your-color';
        return $style;
    });

    Kind Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Altering the input field color’ is closed to new replies.