前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >Add Dark Mode to Your Website

Add Dark Mode to Your Website

作者头像
alanzeng
发布2025-01-14 21:32:38
发布2025-01-14 21:32:38
5100
代码可运行
举报
文章被收录于专栏:alanzeng423
运行总次数:0
代码可运行

Add Dark Mode to Your Website

Add dark mode to your website using DarkReader. This is a simple way to add dark mode to your website.

GitHub: https://github.com/darkreader/darkreader

Add code below to _includes/head.html in your Jekyll project.

代码语言:javascript
代码运行次数:0
复制
{% if jekyll.environment == 'production' -%}
  <!-- dark theme using DarkReader -->
  <script src="//unpkg.com/darkreader@4.9.40/darkreader.js"></script>
  <script type="text/javascript">
    DarkReader.setFetchMethod(window.fetch); // Fix to remedy CORS errors in chrome console
    //DarkReader.enable();
    DarkReader.auto( {brightness: 100, contrast: 90, sepia: 10} );
  </script>
  {%- endif %}

Reference: reference the implementation from link

文章作者: Alan Zeng

原始链接: https://alanzeng.com/blogs/317/

版权说明:本博客所有文章除特别声明外,均采用BY-NC-SA 4.0许可协议 。获得许可后,要求转载时注明文章出处和网站链接,谢谢!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-08-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Add Dark Mode to Your Website
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档