Skip to content

Commit e6a469b

Browse files
committed
colorswitcher dark and light
1 parent 7fac266 commit e6a469b

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

assets/js/colorswitcher.js

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,44 @@
1-
// var challenge_palette = [
2-
// "--learnmyog-purple: #3d3846ff;",
3-
// "--dark-purple: #312744ff;",
4-
// "--prussian-blue: #133754ff;",
5-
// "--bright-navy-blue: #1874ddff;",
6-
// "--viridian-green: #019aa5ff;",
7-
// "--sunglow: #ffcc37ff;",
8-
// "--pearly-purple: #b063aaff;",
9-
// "--magenta-dye: #d0046fff;"
10-
// ];
1+
// Challenge Colors
2+
const mainColors=[
3+
"#3d3846", //--learnmyog-purple: #3d3846ff
4+
"#312744", //--dark-purple: #312744ff
5+
"#133653", //--prussian-blue: #133653ff
6+
"#2a3d37", //--green-mountain: #2a3d37ff
7+
"#4e0d0f", //--barn-red: #4e0d0fff
8+
"#433818", //--army-olive: #433818ff
9+
"#375466", //--blue-wave: #375466ff;
10+
"#800007", //--brick-red: #800007ff;
11+
];
12+
13+
const accentColors = [
14+
"#1874dd", //--bright-navy-blue: #1874ddff
15+
"#019aa5", //--viridian-green: #019aa5ff
16+
"#ffcc37", //--sunglow: #ffcc37ff
17+
"#b063aa", //--pearly-purple: #b063aaff
18+
"#d0046f", //--magenta-dye: #d0046fff
19+
"#c2c1c2", //--silver-bullet: #c2c1c2ff
20+
"#a0743c", //--coyote-brown: #a0743cff
21+
];
22+
23+
const lightColors = ["#ffcc37"]; // these need black text
1124

1225
window.onload=function(){
13-
var colors=[
14-
"#3d3846",
15-
"#1874dd",
16-
"#019aa5",
17-
"#312744",
18-
"#ffcc37",
19-
"#133653",
20-
"#2a3d37",
21-
"#b063aa",
22-
"#d0046f",
23-
"#c5d929",
24-
"#4e0d0f",
25-
"#433818",
26-
"#375466",
27-
"#936621"
28-
];
2926

30-
let lightColors = ["#ffcc37", "#c5d929"];
31-
32-
// let rn = Math.floor(Math.random()*colors.length);
33-
var primary = colors[randomNumberInList(colors)];
34-
var secondary = colors[randomNumberInList(colors)];
27+
let primary = mainColors[randomNumberInList(mainColors)];
28+
let secondary = accentColors[randomNumberInList(accentColors)];
3529
$(':root').css('--banner', primary);
3630
$(':root').css('--overlay', hexToRGB(primary, .4))
3731
if (secondary != primary){
3832
$(':root').css('--spotlight', secondary);
3933
}
4034

4135
// for light colored primary (e.g.) yellow remove invert class for text colors
42-
if( $.inArray(primary, lightColors) != -1){
43-
$('footer').removeClass('invert');
44-
console.log('primary is light')
45-
} else {
46-
console.log('primary is dark so invert');
47-
}
36+
// if( $.inArray(primary, lightColors) != -1){
37+
// $('footer').removeClass('invert');
38+
// console.log('primary is light')
39+
// } else {
40+
// console.log('primary is dark so invert');
41+
// }
4842
console.log("banner is " + primary, "spotlight is " + secondary);
4943
}
5044

0 commit comments

Comments
 (0)