Skip to content

Instantly share code, notes, and snippets.

@luelista
Created December 29, 2018 17:41
Show Gist options
  • Save luelista/985152f88b851f9ef95a0a0a78f387fe to your computer and use it in GitHub Desktop.
Save luelista/985152f88b851f9ef95a0a0a78f387fe to your computer and use it in GitHub Desktop.
Colors tweets with hex color hashtags
// ==UserScript==
// @name HexTweets
// @version 1
// @grant none
// @match https://twitter.com/*
// ==/UserScript==
var re = /^#[a-fA-F0-9]{6}$/;
var hashtags = document.querySelectorAll("div.tweet a.twitter-hashtag");
for(var i in hashtags) {
var hashtag = hashtags[i].innerText;
if (re.test(hashtag)) {
hashtags[i].closest("div.tweet").style.backgroundColor = hashtag;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment