I want to create a string in JavaScript that gives the current time, but I want the hours, minutes, and seconds to be visibly divided by a colon. The pieces should be a different color than the numbers created with JavaScript.
Following the base I want to work with.
JS
var currentTime = document.getElementById('time');
function setTime() {
var date = new Date();
var s = date.getSeconds();
var m = date.getMinutes();
var h = date.getHours();
if (s < 10) {
s = '0' + s;
}
if (m < 10) {
m = '0' + m;
}
if (h < 10) {
h = '0' + h;
}
currentTime.textContent = h + ':' + m + ':' + s;
}
setInterval(setTime, 100);
HTML
<h1 id="time"></h1>
CSS
#time {
margin-top: 7rem;
margin-bottom: 1rem;
font-size: 3.2rem;
color: #60D291;
}