问题描述
我目前使用自定义代码将大多数网站(包括 Google)的默认白色背景更改为背景图片。然而,在某些页面上,文本是黑色的,这使得我很难对照我选择的图像阅读。我想让每个包含我的自定义 BG 图像的页面上的字体具有对比色以提高可读性,但是当我尝试添加到代码时,它用空白的白色背景替换了我的图像,这违背了目的。这是当前的代码:
// @name Custom Google Background
// @namespace http://localhost
// @include http://www.google.*/*
// @include https://www.google.*/*
// @exclude http://www.google.*/search*
// @exclude https://www.google.*/search*
// @exclude http://www.google.*/reader*
// @exclude https://www.google.*/reader*
// @exclude http://www.google.*/calendar*
// @exclude https://www.google.*/calendar*
// @exclude http://www.google.*/ig*
// @exclude https://www.google.*/ig*
// @version 1.0
// @grant none
// ==/UserScript==
var backgroundgImg = "https://i.postimg.cc/tTnzyDq0/Grand-Universe-by-ANTIFAN-REAL.jpg";
var bodyStyle = document.getElementsByTagName("body")[0].style;
bodyStyle.backgroundImage = "url('" + backgroundgImg + "')";
bodyStyle.backgroundRepeat = "no-repeat";
bodyStyle.backgroundPosition = "center top";
bodyStyle.backgroundSize = "cover";```
I have tinkered with inspecting the element on [a page][1] that didn't display a readable font,& used the Style Editor to improve it with these elements:
``` {
background-color: #E3E4FA;
font-family: "Times New Roman",Candara,Segoe,Segoe UI,Optima,Arial,Helvetica,sans-serif;
font-size: 18px;
font-weight: bold;
color: #C38EC7;
}```
However,I don't want to do this every single time for every page that's like this; I want it done automatically. Alternatively,is there a way to make my background image slightly transparent,enough so that it's still a dark display,but I can still read the text? Other than popping it in Photoshop,of course.
Here's an example of what a portion of a page looks like with the current code: [section of sample webpage][2]
Here's what it looks like with modifications to the Style Editor: [section of sample ideal layout][3]
Thanks for any help you can offer me!
[1]: https://www.csprousers.org/help/CSPro/capture_types.html
[2]: https://i.stack.imgur.com/RVGLy.jpg
[3]: https://i.stack.imgur.com/T1qbk.jpg
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)