Created
October 9, 2017 20:06
-
-
Save ericjames/9ce22ff405abc8c547b99987a3d3a4e8 to your computer and use it in GitHub Desktop.
JavaScript: Get all stylesheet rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAllColors() { | |
for (var s in document.styleSheets) { | |
var stylesheet = document.styleSheets[s]; | |
if (stylesheet.title == 'themecolors') { | |
var rule = stylesheet.cssRules[0] || stylesheet.rules[0]; | |
// if (rule.style.color) { | |
// rule.style.color = "red" | |
// } | |
// if (rule.style.background) { | |
// rule.style.background = "black" | |
// } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment