1

I need to change to dark for reCaptcha UI theme. I use asp.net core MVC app.

I tried this:

@section Scripts {
    <script src="https://www.google.com/recaptcha/api.js?render=@Configuration["Recaptcha:siteKey"]"></script>
    <script type="text/javascript">
        var RecaptchaOptions = {
            theme : 'dark',
        };
    </script>
    <script>
        grecaptcha.ready(function() {
            grecaptcha.execute(
                '@Configuration["Recaptcha:siteKey"]', { action: 'contact' })
                .then(function (token) {
                    $("#captchaInput").val(token);
                });
        });
    </script>

    <partial name="_ValidationScriptsPartial" />
}

But it doesnt work - no error just UI same gray:

enter image description here

Boppity Bop
  • 9,613
  • 13
  • 72
  • 151
  • So you declared a variable "RecaptchaOptions" , however, you are not using it anywhere in the code you provided. How is it supposed to work then ? – Noob Nov 13 '21 at 14:10
  • It's taken straight from Google docs. So it's *my* question - how is it supposed to work :) – Boppity Bop Nov 13 '21 at 22:15

0 Answers0