Created
December 30, 2017 17:49
-
-
Save olehmelnyk/1c3dd06a57dab0cc721a41bcbe06de26 to your computer and use it in GitHub Desktop.
Parse from search result, manually, browser-only
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
/** | |
Parse from search result, manually, browser-only | |
go to | |
https://store.pantone.com/eu/en/colorfinder/index/search/q/#ffffff | |
or | |
https://store.pantone.com/eu/en/colorfinder/index/search/q/black | |
where the last param is hex color or color name | |
up to 100 pantone colors will be returned there | |
then paste code below to the console to receive an object with all Pantone colors (code, hex and name if any) from your query | |
PS: this didn't work async because results loads with delay, after ajax response is sent | |
*/ | |
let pantones = []; | |
document.querySelectorAll('a.swatchContainer').forEach(element => { | |
pantones.push({ | |
hex: element.dataset.hexCode, | |
colorCode: element.dataset.colorCode, | |
name: element.dataset.colorName | |
}); | |
}); | |
console.log(pantones); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment