• android webview夜间模式javascript代码
    • 修改Background属性
    • 修改Background-Color属性
    • 利用invert属性翻转网页颜色 CSS代码

android webview夜间模式javascript代码

本人主要总结了以下三类android webview 夜间模式javascript代码。

  • 修改Background属性
  • 修改Background-Color属性
  • 利用invert属性翻转网页颜色

修改Background属性

style=document.createElement('style');style.setAttribute('type','text/css');styleElem=document.getElementsByTagName('head')[0].appendChild(style);styleElem.innerHTML='';child=document.createTextNode('body,body * {background:#2e2e2e!important;color:RGB(200,200,200) !important;}');styleElem.appendChild(child);

修改Background-Color属性

style=document.createElement('style');style.setAttribute('type','text/css');styleElem=document.getElementsByTagName('head')[0].appendChild(style);styleElem.innerHTML='';child=document.createTextNode('body,body * {background-color:#2e2e2e!important;color:RGB(200,200,200) !important;}');styleElem.appendChild(child);

利用invert属性翻转网页颜色 CSS代码:

html {    background-color : #2e2e2e !important;    zoom             : 1.055;  }body {    text-rendering             : optimizeSpeed;    image-rendering            : optimizeSpeed;    -webkit-image-rendering    : optimizeSpeed;    text-shadow            : 0 0 0 #000;    -webkit-font-smoothing : antialiased;    -webkit-filter         : invert(1)hue-rotate(180deg);    -ms-filter             : invert(1)hue-rotate(180deg);    filter                 : invert(1)hue-rotate(180deg);}input,textarea,select{color:purple}img, video, iframe, canvas, svg,embed[type='application/x-shockwave-flash'],object[type='application/x-shockwave-flash'],*[style*='url('] {    -webkit-filter : invert(1)hue-rotate(180deg) !important;    -ms-filter     : invert(1)hue-rotate(180deg) !important;    filter         : invert(1)hue-rotate(180deg) !important;}

更多相关文章

  1. 没有一行代码,「2020 新冠肺炎记忆」这个项目却登上了 GitHub 中
  2. Android(安卓)一个简单手机响铃功能实现
  3. android 关于localhost和访问本机服务的方法
  4. Android实现图片叠加效果的两种方法
  5. Android(安卓)px sp dip转化
  6. Android(安卓)NDK 开发教程三:Hello JNI 示例
  7. Android(安卓)BCM4330 FM 驱动驱动
  8. Android(安卓)几行代码解决6.0以上权限适配问题
  9. Activity的正确打开方式

随机推荐

  1. Dealing with dependencies in Android p
  2. 最新統計:44% IT 和商務人士選擇 Android(
  3. imageView 的 android:maxHeight,maxWidt
  4. RK3288 Android 7.1 屏蔽“您的设备内部
  5. android中基于网络和GPS的不同精度定位
  6. Android AppWidget系统框架
  7. Mac Yosemite下Android Studio环境问题集
  8. Android 中文 API (36) —— Toast
  9. Android 中Activity,Window和View之间的
  10. eclipse android安装