Skip to content

Instantly share code, notes, and snippets.

@gastonambrogi
Created June 13, 2016 22:24
Show Gist options
  • Save gastonambrogi/e6d4240db0487fe0c952ec390ea7200a to your computer and use it in GitHub Desktop.
Save gastonambrogi/e6d4240db0487fe0c952ec390ea7200a to your computer and use it in GitHub Desktop.
function randomColor(backgroundFlag) {
var gradients = [
['#19B6C1','#03599A','#0E88AE'], //great
['#27C4B9','#27C495', '#27C4A7'],
['#97437E','#DC245B','#B9336C'],
['#136a8a','#267871','#1C717D'], //not sure
['#6441A5','#2a0845','#472475'], //might be redundant of one below
// ['#1A1023','#53346D','#362248'], //great, dark mysterious
['#7C8E8D','#2F3950','#56646F'],
['#00d2ff','#3a7bd5','#1DA6EA'], //great
['#DE6262','#F7AC7E','#EA8770']
]
item = gradients[Math.floor(Math.random()*gradients.length)]
var highlightColor = '#';
var highlightLetters = ['FD7240','3888F2','00C186','F278DE'];
highlightColor += highlightLetters[Math.floor(Math.random() * highlightLetters.length)];
if (backgroundFlag == true){
if(!$('body').hasClass('showFont') || $('body').hasClass('domainClick') || $('body').hasClass('topFonts')) {
if(fadedYet == true) {
$gradientPanel.css('background-image', 'linear-gradient(-90deg, ' + item[0] +', ' + item[1] + ')');
$footerBg.css('background-image', 'linear-gradient(-90deg, ' + item[0] +', ' + item[1] + ')');
$gradientPanel.addClass('show');
setTimeout(function(){
$panel.css('background-image', 'linear-gradient(-90deg, ' + item[0] +', ' + item[1] + ')');
$gradientPanel.removeClass('show');
}, 800);
} else {
$footerBg.css('background-image', 'linear-gradient(-90deg, ' + item[0] +', ' + item[1] + ')');
$panel.css('background-image', 'linear-gradient(-90deg, ' + item[0] +', ' + item[1] + ')');
}
if($body.hasClass('topFonts')) {
if(fadedYet == true) {
$cubeFaces.css('background-color', item[2]);
} else {
setTimeout(function(){
$cubeFaces.css('background-color', item[2]);
}, 500);
}
} else {
$cubeFaces.css('background-color', item[2]);
}
fadedYet = true;
}
} else if (backgroundFlag == false) {
$("span.highlight").css('color', highlightColor);
$(".outline").css('borderColor', highlightColor);
$(".used-by").css('color', highlightColor);
$(".rank").css('color', highlightColor);
} else {
$optionsLink.css('color', highlightColor);
$optionsLink.css('background-color', hex2rgba(highlightColor,8));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment