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
| /** | |
| * Parsing 3rd party website | |
| * not sure how accurate/valid/outdated it is | |
| * and this resource might be closed any time | |
| * but https://github.com/teelaunch/pms-pantone-color-chart | |
| * uses this site here https://github.com/teelaunch/pms-pantone-color-chart/blob/master/pantone.js#L9 | |
| * */ | |
| async function rgbToPantone(RGB){ | |
| return fetch(`http://www.netfront.fr/Services/rgb2pantone/pantone.htm?r=${RGB[0]}&g=${RGB[1]}&b=${RGB[2]}`) | |
| .then(resolve => resolve.text()) |
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
| // get HEX/RGB/CMYK by Pantone code (parse official Pantone website search result) | |
| async function pantone(pantoneCode){ | |
| pantoneCode = pantoneCode // validate input: | |
| .trim() | |
| .replace(/^PANTONE /i, '') // we don't need 'PANTONE ' here | |
| .replace(/ /g, '-'); // no spaces | |
| return fetch(`https://www.pantone.com/color-finder/${pantoneCode}`) | |
| .then(response => response.text()) | |
| .then(doc => new DOMParser().parseFromString(doc, 'text/html')) |
NewerOlder