react-oauth icon indicating copy to clipboard operation
react-oauth copied to clipboard

The dark theme is terrible

Open ptahchiev opened this issue 2 years ago • 11 comments

I was hoping to create a dark version of the button by setting theme to "filled_black", but the result is this:

login-google

As you can see there's a white background in the iframe and it looks terrible. I was unable to overrride it with CSS because it is an iframe

ptahchiev avatar Dec 06 '23 15:12 ptahchiev

Can you try adding color-scheme dark to your project IDK if it will make google's iframe to render in dark https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme

MomenSherif avatar Dec 06 '23 18:12 MomenSherif

Hello, thank you for your reply. Where do I need to put this CSS property?

ptahchiev avatar Dec 06 '23 19:12 ptahchiev

:root similar to mdn example

MomenSherif avatar Dec 06 '23 19:12 MomenSherif

I tried - no effect.

ptahchiev avatar Dec 06 '23 20:12 ptahchiev

I removed the color-scheme altogether from my css, and the button now renders correctly in both dark and light themes (I have a switch that changes data-theme="light" / "dark" in my application.

alejandro-sanserg avatar Mar 04 '24 00:03 alejandro-sanserg

How did you remove the color-scheme?

ptahchiev avatar Mar 04 '24 00:03 ptahchiev

I just had :root { color-scheme: light dark; } in my index.css and removed that line, for some reason this made it work.

alejandro-sanserg avatar Mar 04 '24 00:03 alejandro-sanserg

I just had :root { color-scheme: light dark; } in my index.css and removed that line, for some reason this made it work.

Thank you

mannakub11 avatar May 07 '24 15:05 mannakub11

I just had :root { color-scheme: light dark; } in my index.css and removed that line, for some reason this made it work.

I don't have that line in my css, what can I change to fix it?

aryanranderiya avatar Feb 18 '25 15:02 aryanranderiya

I just had :root { color-scheme: light dark; } in my index.css and removed that line, for some reason this made it work.

I don't have that line in my css, what can I change to fix it?

Wrap your GoogleLogin like this:

<div style={{ colorScheme: 'light' }}>
      <GoogleLogin ... />
</div>

belmeopmenieuwesim avatar Mar 10 '25 03:03 belmeopmenieuwesim

colorScheme: 'auto' for Mantine users works ok

gvillo avatar Jun 02 '25 21:06 gvillo

colorScheme: 'auto' for Mantine users works ok

This works fine

ptahchiev avatar Aug 24 '25 10:08 ptahchiev