Skip to content

Instantly share code, notes, and snippets.

@pixelthing
Created May 13, 2022 14:09
Show Gist options
  • Save pixelthing/e2b06cea233a535c43e0f94dbe41a6b0 to your computer and use it in GitHub Desktop.
Save pixelthing/e2b06cea233a535c43e0f94dbe41a6b0 to your computer and use it in GitHub Desktop.
Browser favelet for re-colouring Google Analytics 4 exploration graphs
javascript:(function () { const swaps = { '1f4495' : 'e6194B', '2f5ec4' : 'f58231', '356fdb' : 'ffe119', '4285f4' : 'bfef45', '4495f2' : '3cb44b', '45a5f5' : '42d4f4', '68bced' : '4363d8', '93d5ed' : '911eb4', 'bde9f2' : 'f032e6', 'dcf7fa' : 'a9a9a9', 'd0e5f5' : '800000', 'c0cef6' : '9A6324', 'b3baf7' : '808000', 'a6a7f9' : '469990', '968efa' : '000075', '8473f9' : 'fabed4', '765ee5' : 'ffd8b1', '694bd3' : 'fffac8', '5432b6' : 'aaffc3', '3f18a3' : 'dcbeff', }; for (const existingColour in swaps) { const replacementColour = swaps[existingColour]; const strokes = document.querySelectorAll(`[stroke="#${existingColour}"]`); if (strokes) { strokes.forEach(d => { d.setAttribute('stroke','#' + replacementColour) }); } const fills = document.querySelectorAll(`[fill="#${existingColour}"]`); if (fills) { fills.forEach(d => { d.setAttribute('fill','#' + replacementColour) }); } };})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment