paste.maymeow.lol / colorize.md · 8 months ago·

Colorize icons with Catppucchin Macchiato theme by https://matt.omg.lol/ and https://adam.omg.lol/

```javascript
<script>
document.addEventListener("DOMContentLoaded", function () {
	
	// define the colors for the icons
	const colors = ['#ed8796', '#ee99a0', '#f5a97f', '#eed49f', '#a6da95', '#8bd5ca', '#91d7e3', '#7dc4e4', '#8aadf4', '#b7bdf8'];
	
	// choose icon colors at random
	const icons = document.getElementsByTagName('i');
	for (let item of icons) {
		item.style.color = colors[Math.floor(Math.random() * colors.length)];
	}
	
	// or, apply them in order
	let i = 0;
	for (let item of icons) {
		console.log(item);
		item.style.color = colors[i];
		if(i == colors.length - 1) {
				i = 0;
		}
		else {
				i++;
		}
	}
	
});
</script>
```