Get started with tinycolor CDN
MIT licensed
TinyColor is a lightweight C library for handling RGB and HSL color values.
Tags:- color
Stable version
Copied!
How to start using tinycolor CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with tinycolor CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/tinycolor/1.6.0/tinycolor.min.js"></script>
</head>
<body>
<button id="change-color">Change color</button>
<div id="color-box" style="width: 100px; height: 100px; background-color: #ff0000;"></div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const colorButton = document.getElementById('change-color');
const colorBox = document.getElementById('color-box');
colorButton.addEventListener('click', () => {
const randomColor = TinyColor.random().toHexString();
colorBox.style.backgroundColor = randomColor;
colorButton.textContent = `New color: ${randomColor}`;
});
});
</script>
</body>
</html>
Copied!
Copied!