-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheugenia.min.js
1 lines (1 loc) · 1.14 KB
/
eugenia.min.js
1
function rgb(e,t,n){return"rgb("+e+", "+t+", "+n+")"}function rgba(e,t,n,s){if(s>=1)var r=s+"%";else if(null==s)r=1;else r=s;return"rgba("+e+", "+t+", "+n+", "+r+")"}function hsl(e,t,n){return"hsl("+e+", "+t+"%, "+n+"%)"}function hsla(e,t,n,s){if(s>=1)var r=s+"%";else if(null==s)r=1;else r=s;return"hsla("+e+", "+t+"%, "+n+"%, "+r+")"}var Eugenia=function(){function e(e){void 0===e&&(e="eugenia-js-stylesheet");var t=document.createElement("style");t.id=e,document.documentElement.appendChild(t),this._styleSheet=t,this._styleSheetObject={}}return e.prototype.set_theme=function(e){for(var t in e)if("."==t[0]){for(var n in e[t])null==this._styleSheetObject[t]&&(this._styleSheetObject[t]={}),this._styleSheetObject[t][n]=e[t][n];for(var n in this._styleSheet.innerHTML="",this._styleSheetObject){for(var s in this._styleSheet.innerHTML+=n+"{",this._styleSheetObject[n])this._styleSheet.innerHTML+=s+":"+this._styleSheetObject[n][s]+";";this._styleSheet.innerHTML+="}"}}else if("#"==t[0]){var r=t.substring(1),i=document.getElementById(r);for(var n in e[t])i.style.setProperty(n,e[t][n])}else document.documentElement.style.setProperty("--"+t,e[t]);return e},e}();