I need to cycle through bright colors using CSS just like how your RGB mouse and keyboards are and so far I have a solution sort of working using HSL. It does however include some really dark colors that I'm trying to skip. But obviously when you skip some, the transitions won't be smooth.
var hue = 0;
$(document).ready(function() {
setInterval(function() {
// Reset the hue if we reach the end
if(hue >= 360) {
hue = 0;
}
// Skip some dull colors (hue 210 to 270)
if(hue >= 210 && hue <= 270) {
hue = 271;
}
// Set the background
$('body').css('background-color', 'hsl(' + hue + ', 100%, 60%)');
// Increase the hue
hue++;
}, 50);
});
body {
background-color: hsl(0, 100%, 60%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
What do I need to do to get just bright colors but also ensuring that the transitions are smooth?