web-bayern contrast methods

This commit is contained in:
Rainer Gümpelein 2022-03-24 07:25:20 +01:00
parent be4d83cc8d
commit 1503e52196
6 changed files with 127 additions and 43 deletions

View file

@ -1,3 +1,4 @@
function change_fontsize1(){
document.getElementById('Contenttxt').style.cssText = 'font-size:1em;';
}
@ -8,6 +9,49 @@ function change_fontsize3(){
document.getElementById('Contenttxt').style.cssText = 'font-size:1.4em;';
}
function change_contrast(){
var element = document.querySelectorAll('*');
for (var i = 0; i < element.length; i++) {
//const bgcol = element[i].style.backgroundColor;
const style = getComputedStyle(element[i]);
const bgcol = style.backgroundColor;
console.log(bgcol);
const fgcol = style.color;
console.log(fgcol);
if(bgcol == ('rgb(0, 141, 210)')){ //008dd2 (blue)
element[i].style.backgroundColor = "rgb(63, 63, 63)";//3f3f3f (black)
element[i].style.color = "rgb(255, 255, 254)";//white
}
if(bgcol == ('rgb(63, 63, 63)')){ //black
element[i].style.backgroundColor = "rgb(0, 141, 210)";
element[i].style.color = "rgb(255, 255, 254)";
}
//hover active
if(bgcol == ('rgb(3, 101, 149)')){ //036595 (darkblue)
element[i].style.backgroundColor = "rgb(255, 255, 254)";
element[i].style.color = "rgb(63, 63, 63)";
}
//hover active
if(bgcol == ('rgb(255, 255, 254)')){ //fffffe (white)
element[i].style.backgroundColor = "rgb(3, 101, 149)";
element[i].style.color = "rgb(255, 255, 254)";
}
//if only font ist colored and backround is white
if(fgcol == ('rgb(0, 141, 210)') && bgcol == ('rgb(255, 255, 255)')){ //008dd2
element[i].style.color = "rgb(63, 63, 63)";
element[i].style.backgroundColor = "rgb(255, 255, 255)";
}
if(fgcol == ('rgb(63, 63, 63)') && bgcol == ('rgb(255, 255, 255)')){ //black
element[i].style.color = "rgb(0, 141, 210)";
element[i].style.backgroundColor = "rgb(255, 255, 255)";
}
}
}
function show_passwd() {
var x = document.getElementById('txt04');
if (x.type === "password") {