Skip to content

Instantly share code, notes, and snippets.

@brittlewis12
Last active November 6, 2021 21:19
Show Gist options
  • Save brittlewis12/1b67a7557d1abe6e560948538b0f9bc6 to your computer and use it in GitHub Desktop.
Save brittlewis12/1b67a7557d1abe6e560948538b0f9bc6 to your computer and use it in GitHub Desktop.
source for roam/js snippet to append a meta element to head to tell twitter to render tweets with a dark theme
// adapted from https://github.com/wirtzdan/roam-js-extensions
// Twitter embed customization docs https://developer.twitter.com/en/docs/twitter-for-websites/webpage-properties
const themeMeta = document.createElement('meta');
themeMeta.name = "twitter:widgets:theme";
themeMeta.content = "dark";
document.getElementsByTagName("head")[0].appendChild(themeMeta);
const dntMeta = document.createElement('meta');
dntMeta.name = "twitter:dnt";
dntMeta.content = "on";
document.getElementsByTagName("head")[0].appendChild(dntMeta);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment