1
2
3
4
5
6
7
8
9
10
|
function linMap(c,mn,mx){return c*(mx-mn)+mn;}
function getDecimal(n){return(n-Math.floor(n));}
function mapColorPalete(c,palete){let poz=c*(palete.length-1);let col1=palete[Math.floor(poz)];let col2=palete[Math.ceil(poz)];return(Math.floor(linMap(getDecimal(poz),col1[0],col2[0])).toString(16).padStart(2,0)+
Math.floor(linMap(getDecimal(poz),col1[1],col2[1])).toString(16).padStart(2,0)+
Math.floor(linMap(getDecimal(poz),col1[2],col2[2])).toString(16).padStart(2,0)).toUpperCase();}
function intToRGB(i,palete=null){if(palete==null){var c=(i&0x00FFFFFF).toString(16).toUpperCase();return"00000".substring(0,6-c.length)+c;}else return mapColorPalete((i&0xFF)/0xFF,palete);}
function getHexColorFromString(str){if(urnikTheme=="privzeta")
return"#"+intToRGB(hashCode(str));else
return"#"+intToRGB(hashCode(str),[[38,70,83],[42,157,143],[233,196,106],[244,162,97],[231,111,81]]);}
|