Created
April 1, 2022 03:27
-
-
Save garudamon/42a22a514d07e8482214455d292ac8ef to your computer and use it in GitHub Desktop.
Colors Scheme Collector
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
| // this script is only working with: | |
| // https://www.schemecolor.com/?s=pastel | |
| const rgb2hex = (rgb) => `#${rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/).slice(1).map(n => parseInt(n, 10).toString(16).padStart(2, '0')).join('')}`; | |
| let colors = []; | |
| document.querySelectorAll('.color-palettes-list li').forEach((ct) => { | |
| let c = ct.querySelectorAll('.c'); | |
| let clen = c.length; | |
| for (let i = 0; i < clen; i++) { | |
| let rgb = window.getComputedStyle(c[i], null).getPropertyValue('background-color'); | |
| let hex = rgb2hex(rgb) | |
| colors.push(hex); | |
| } | |
| }); | |
| console.log(colors); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment