MY blog has dark color switch. I want Facebook comments to switch to dark colors too. I know how to set 'data-colorscheme' attribute to 'dark' using JS, obviously this alone wont affect the current iframe. Any suggestions?
Asked
Active
Viewed 428 times
0
-
Replace the HTML element used to embed the plugin with a new one, call `FB.XFBML.render()` afterwards to get it rendered. – CBroe Mar 30 '20 at 06:23
-
Is it possible to replace the attribute only? I tried replacing attribute then called FB.XFBML.render(). I got "Uncaught ReferenceError: FB is not defined at HTMLDivElement.
" – Nick Moss Mar 30 '20 at 11:50 -
Please show a proper [mre] of what you are doing. – CBroe Mar 30 '20 at 11:53
-
`const facebookComment = document.querySelector('.fb-comments'); facebookComment.setAttribute("data-colorscheme", "dark"); FB.XFBML.parse();` – Nick Moss Mar 30 '20 at 12:11
-
I meant, how you are embedding the comment plugin in the first place. – CBroe Mar 30 '20 at 12:35
-
[link](https://codepen.io/MikeMoss/pen/qBdgMoX) – Nick Moss Mar 30 '20 at 21:00
-
Switching between dark and light mode seems to work fine there? – CBroe Mar 31 '20 at 06:09
1 Answers
0
Apparently this is a known issue (several bug reports filed) that Facebook is opting not to fix. See this post.

zinndesign
- 188
- 2
- 11