UNPKG

always-helper

Version:

前端项目开发中,经常会用到一些工具函数的合集。

2 lines (1 loc) 685 B
var e;!function(e){e[e.append=0]="append",e[e.prepend=1]="prepend"}(e||(e={}));export default function(){!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"append",n=document.createElement("style");n.setAttribute("type","text/css"),n.innerHTML=e,"append"===t?document.head.appendChild(n):document.head.insertBefore(n,document.head.childNodes[0])}("html[theme='dark-mode'] {\n filter: invert(1) hue-rotate(180deg);\n }\n html[theme='dark-mode'] img{\n filter: invert(1) hue-rotate(180deg);\n }\n html {\n transition: color 300ms, background-color 300ms;\n }\n "),document.documentElement.setAttribute("theme","dark-mode")}