By default, when using reCAPTCHA, the theme of the captcha box is set to Light.
Creating the form
First, we’ll begin with creating our form and adding our fields. If you need any help in how to create a form, please review this documentation.
Enabling reCAPTCHA on your form
Next, you’ll need to set up reCAPTCHA to your form. If you need assistance setting this up you can review our full documentation on How to Set Up reCAPTCHA in WPForms.
The code shown below is specifically for the Google Checkbox v2 reCAPTCHA setting that you’ll enable on your form’s Settings » Spam Protection and Security tab.
In the code snippet below we’ll be adding a tag attribute to the .g-recaptcha div and set a data-theme tag to have a value of dark. This is what will change the captcha theme on the form.
Now that reCAPTCHA has been added to your form, you can see what it looks like by default.
You can take a look at the reCAPTCHA Developers Guide from Google if you’d like to change any of the other default attributes.
Finally, you’ll need to add the following code snippet to your site. If you need any help in how to add snippets to your site, please review this tutorial.
Once the code has been added to your site, your captcha theme will now be set to Dark.
This snippet will also change the theme of the Invisible reCAPTCHA v2 as well as hCAPTCHA.
And that’s it! You’ve successfully changed the captcha theme from Light to Dark. Would you like to change the styling on the form’s placeholder text? Take a look at our article on How to Style Placeholder Text for Form Fields.
Action Reference: wpforms_wp_footer_end
Q: Can I also change the theme for hCAPTCHA?
A: Absolutely, you don’t even need another script for this! You can use the same snippet to change the theme to dark for both reCAPTCHA v2, Invisible reCAPTCHA v2, and hCAPTCHA.