I am trying to improve some of my JS skills.
I have a number of colours in hex which are in an object stored as foreground colours and background colours.
When the width of the webpage is a particular size i want to make sure that some specific colours are NOT used from the object to change the text colour.
How heres what I have so far. This works fine...and i know i could use a switch too but can anyone else improve the if || statemenent please?
var colorThemes = [
// Combo 1:
{ foreground: "#0A1C6B", background: "#5DF0AD" },
// Combo 2:
{ foreground: "#C2F5FF", background: "#0A1C6B" },
// Combo 3:
{ foreground: "#583985", background: "#CCCCF0" },
// Combo 4:
{ foreground: "#FBBEA6", background: "#5839B5" },
// Combo 5:
{ foreground: "#8A350D", background: "#FFDB0D" }
]
var randomnumber = Math.floor((Math.random() * colorThemes.length));
var selector = colorThemes[randomnumber]
if (selector.foreground === "#0A1C6B" || selector.foreground === "#5DF0AD" || selector.foreground === "#C2F5FF" || selector.foreground === "#ABD1fA" || selector.foreground === "#FBBEA6" || selector.foreground === "#FACCD4" || selector.foreground === "#FF5919" || selector.foreground === "#D9F2AD" || selector.foreground === "#83BF25"){
copyCount[i].style.color = selector.background;
}
}'
Thank you