Skip to content

Instantly share code, notes, and snippets.

@SnejUgal
Last active July 7, 2019 13:04
Show Gist options
  • Save SnejUgal/fffde7f8506b4275fa2e4b0881b54043 to your computer and use it in GitHub Desktop.
Save SnejUgal/fffde7f8506b4275fa2e4b0881b54043 to your computer and use it in GitHub Desktop.
Find and replace for .attheme editor
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