Last active
July 7, 2019 13:04
-
-
Save SnejUgal/fffde7f8506b4275fa2e4b0881b54043 to your computer and use it in GitHub Desktop.
Find and replace for .attheme editor
This file contains 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
const find = Color.parseHex("#607d8b"); | |
const replace = Color.parseHex("#abcdef"); | |
// ↑ Replace these colors. The alpha channel | |
// is ignored. | |
// Below starts the find and replace logic. | |
const variables = activeTheme.getVariables(); | |
variables.forEach((variable) => { | |
const color = ( | |
activeTheme.getVariable(variable) | |
); | |
if ( | |
color.red == find.red | |
&& color.green == find.green | |
&& color.blue == find.blue | |
) { | |
activeTheme.setVariable(variable, replace); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment