Color Matching Game

COLOR MATCHING GAME
1. Match the colors using the slider. If the colors match click the button! The result is displayed bellow.
2. 7 colors must be matched to complete a level! (red, orange, yellow, green, turquoise, blue and purple).
3. To get to the next level the average difference should be less than 8! It will be more and more difficult.
4. There are 3 levels: easy, medium, hard.



Hue:

Lum:



Colorlite glasses will significantly improve your color vision.
Visit one of our affiliate Eye Care Professionals for a personalized diagnostic test and get a custom prescription for color correction lenses.

Contcat

.enjoy-css { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; margin: 5px; padding: 10px; border: none; -webkit-border-radius: 10px; border-radius: 10px; font: normal 16px/1.5 "Lucida Sans Unicode", "Lucida Grande", sans-serif; color: black; -o-text-overflow: ellipsis; text-overflow: ellipsis; background: White; -webkit-box-shadow: 4px 4px 6px 1px rgba(0,0,0,0.4) ; box-shadow: 4px 4px 6px 1px rgba(0,0,0,0.4) ; } .center { margin: auto; max-width: 1170px; border: 0px solid #73AD21; padding: 10px; text-align: center; } body {font-family: Arial,Helvetica,sans-serif;} h1 {background-color: green;} #d1 {display: inline-block; } #d3 {display: inline-block; } p { font-size: 14px; color: black} #p1 { font-size: 5px; color: black} #p2 { font-size: 20px; color: black} .pleft { text-align: left!important; } .slidecontainer { width: 100%; } .slider { -webkit-appearance: none; width: 100%; height: 25px; border-radius: 10px; background: #d3d3d3; outline: none; opacity: 0.7; -webkit-transition: .2s; transition: opacity .2s; } .slider:hover { opacity: 1; } .slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 50px; height: 50px; border-radius: 50%; background: #4CAF50; cursor: pointer; } .slider::-moz-range-thumb { width: 50px; height: 50px; border-radius: 50%; background: #4CAF50; cursor: pointer; } #d1 { border: 0px solid red; padding: 10px; border-radius: 10px; } #d1 { border: 0px solid red; padding: 10px; border-radius: 10px; } #d3 { border: 0px solid red; padding: 10px; border-radius: 10px; } .button { display: inline-block; padding: 5px 25px; font-size: 18px; cursor: pointer; text-align: center; text-decoration: none; outline: none; color: Black; background-color: Silver; border: none; border-radius: 15px; box-shadow: 0 5px #999; } .button:hover {background-color: RGB(220,255,220)} .button:active { background-color: #3e8e41;; box-shadow: 0 5px #666; transform: translateY(4px); } select { font-size: 32px; } /* body select.select_box */ body select { padding: 10px 70px 10px 13px !important; max-width: 100%; height: auto !important; border: 3px solid Gray; border-radius: 5px; background: url("https://image.ibb.co/iMeAJv/selectbox_arrow.png") right center no-repeat; background-color: #fff; color: #444444; font-size: 20px; line-height: 20px !important; appearance: none; /* this is must */ -webkit-appearance: none; -moz-appearance: none; } /* body select.select_box option */ body select option { padding: 0 4px; } /* for IE and Edge */ select::-ms-expand { display: none; } select:disabled::-ms-expand { background: #f60;} window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-384378-15'); COLOR MATCHING GAME 1. Match the colors using the slider. If the colors match click the button! The result is displayed bellow. 2. 7 colors must be matched to complete a level! (red, orange, yellow, green, turquoise, blue and purple). 3. To get to the next level the average difference should be less than 8! It will be more and more difficult. 4. There are 3 levels: easy, medium, hard. Easy level Hue: Lum: GET THE NEXT COLOR! Colorlite glasses will significantly improve your color vision. Visit one of our affiliate Eye Care Professionals for a personalized diagnostic test and get a custom prescription for color correction lenses. Contcat var slider = document.getElementById("myRange"); var output = document.getElementById("Hue"); var outputLum = document.getElementById("Lum"); var Testszinek,i=0,j=5, Range, Sorrend; Range = [[0],[0],[0],[0],[0],[0],[0]]; Tesztszinek= [[0,0],[30,0],[60,0],[120,0],[180,0],[240,0],[300,0]]; Sorrend = [[5],[3],[1],[4],[2],[0],[6]]; output.innerHTML = slider.value; outputLum.innerHTML = "50%"; tCiklus(); function myFunctionDarkness() { document.getElementById("Lum").innerHTML = document.getElementById("mySelect").value; document.getElementById("mySelect").disabled=true; tCiklus(); } function tCiklus(){ var Colordiv, Colordiv2; Tesztszinek[j][1]= slider.value; Colordiv='hsl('+Tesztszinek[j][0]+',100%,'+outputLum.innerHTML+')'; Colordiv2='hsl('+slider.value+',100%,'+outputLum.innerHTML+')'; document.getElementById("d1").style.backgroundColor = Colordiv; document.getElementById("d3").style.backgroundColor = Colordiv2; } slider.oninput = function() { var Colordiv; output.innerHTML = this.value; Colordiv='hsl('+this.value+',100%,50%)'; document.getElementById("d3").style.backgroundColor = Colordiv; tCiklus(); } function kiertekel(){ kiertekel3();Rajzol1(); if (i==6) {i=-1;} i=i+1; j=Sorrend[i]; tCiklus(); document.getElementById("myProgress").value = i; } function kiertekel3(){ var text,texttarget,textcolor1,textRange,avgdifference,medal; var vege=""; var x = document.getElementById("mySelect"); Range[j]=Math.abs(Tesztszinek[j][1]-Tesztszinek[j][0]); if (Range[j]>180) {Range[j]=Math.abs(360-Range[j]);} if (Tesztszinek[j][1]>=360) {Tesztszinek[j][1]=Tesztszinek[j][1]-360;} if (j==0) {texttarget=" (red) ";} if (j==1) {texttarget=" (orange) ";} if (j==2) {texttarget=" (yellow) ";} if (j==3) {texttarget=" (green) ";} if (j==4) {texttarget=" (turquoise) ";} if (j==5) {texttarget=" (blue) ";} if (j==6) {texttarget=" (purple) ";} if (i==6) {avgdifference=Math.round((Range[0]+Range[1]+Range[2]+Range[3]+Range[4]+Range[5]+Range[6])/7); if (avgdifference<=7) { if (x.value=="10%") { gtag('event','colormatch_hard'); vege=" GAME OVER! Congratulation to complete all levels! You are a COLOR MATCHING CHAMPION! ";} if (x.value=="25%") { vege=" Congratulation to complete the Medium level! Now you can try the HARD level! "; var option = document.createElement("option"); gtag('event','colormatch_medium'); //google analytics option.text = "Hard level"; x.remove(2); x.add(option); document.getElementById("mySelect").selectedIndex = "2"; option.value="10%" Sorrend = [[6],[2],[0],[5],[1],[3],[4]]; myFunctionDarkness(); } if (x.value=="50%") { vege=" Congratulation to complete the EASY level! Now you can try the MEDIUM level! "; var option = document.createElement("option"); gtag('event','colormatch_easy'); option.text = "Medium level"; x.remove(1); x.add(option); document.getElementById("mySelect").selectedIndex = "1"; option.value="25%" Sorrend = [[3],[4],[6],[2],[0],[5],[1]]; myFunctionDarkness(); } } if (avgdifference>7) {vege=" Level completed, but to get to the next level the average difference should be less than 8! Try again! ";} vege=vege+" The average difference of the level was: "+avgdifference+" "; document.getElementById("mySelect").disabled=false; } if (Tesztszinek[j][1]>=330 | Tesztszinek[j][1]<=20) {textcolor1=", in the redish color range.";} if (Tesztszinek[j][1]>20 & Tesztszinek[j][1]<40) {textcolor1=", in the orangish color range.";} if (Tesztszinek[j][1]>=40 & Tesztszinek[j][1]<=75) {textcolor1=", in the yellowish color range.";} if (Tesztszinek[j][1]>75 & Tesztszinek[j][1]<165) {textcolor1=", in the greenish color range.";} if (Tesztszinek[j][1]>=165 & Tesztszinek[j][1]<=190) {textcolor1=", in the turquoise color range.";} if (Tesztszinek[j][1]>190 & Tesztszinek[j][1]<275) {textcolor1=", in the blueish color range.";} if (Tesztszinek[j][1]>=275 & Tesztszinek[j][1]<330) {textcolor1=", in the purplish color range.";} if (Range[j]==0) {textRange="Exactly! Perfect match! Congratulation! Keep going! ";} if (Range[j]>0 & Range[j]<3) {textRange="Almost got it! Congratulation! Try to get a perfect match next! ";} if (Range[j]>=3 & Range[j]<6) {textRange="It was very near! Try to get a perfect match next! ";} if (Range[j]>=6 & Range[j]<10) {textRange="It was near, but could be closer! Try to get it! ";} if (Range[j]>=10 & Range[j]<20) {textRange="So-so. Try the get closer next! ";} if (Range[j]>=20 & Range[j]<40) {textRange="Sorry, not match. Try the get closer next! ";} if (Range[j]>=40) {textRange="Far! Try to get closer next! ";} text=textRange+vege+" The target hue value was "+Tesztszinek[j][0]+texttarget+ " The matched color was: "+Tesztszinek[j][1]+textcolor1+ " Difference of the matched colors: "+Range[j]+"."; document.getElementById("p2").innerHTML = text; document.getElementById("p2").style.fontSize = "14px"; } window.onload = function Rajzol() { var c = document.getElementById("myCanvas"); var ctx1 = c.getContext("2d"); var img = document.getElementById("scale"); img.style.display = "none"; ctx1.drawImage(img, 0, 0); ctx1.stroke(); } function Rajzol1() { var c = document.getElementById("myCanvas"); var ctx1 = c.getContext("2d"); var img = document.getElementById("scale"); img.style.display = "none"; ctx1.drawImage(img, 0, 0); ctx1.beginPath(); ctx1.moveTo(2*Tesztszinek[j][0],33); ctx1.lineTo(2*Tesztszinek[j][1],155); ctx1.lineWidth = 1; ctx1.strokeStyle="Black"; ctx1.stroke(); }