-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinternal-page-theme.js
62 lines (60 loc) · 2.12 KB
/
internal-page-theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Internal Page Theme
// version 2021.9.0
// https://forum.vivaldi.net/topic/57420/theme-internal-pages
// Injects CSS into the internal pages vivaldi://about and about:blank, uses
// native theme colors. Relies on chrome.tabs restore method
// ☛ https://forum.vivaldi.net/topic/57191/restore-methods-for-chrome-tabs
(function () {
function intpages(id, page) {
const bg = document.documentElement.style.getPropertyValue("--colorBg");
const bgdark =
document.documentElement.style.getPropertyValue("--colorBgDark");
const fg = document.documentElement.style.getPropertyValue("--colorFg");
const fgintense =
document.documentElement.style.getPropertyValue("--colorFgIntense");
const hi =
document.documentElement.style.getPropertyValue("--colorHighlightBg");
if (page === "chrome://version/") {
var sendit = `
html {
background-image: linear-gradient(to bottom, transparent 50%, ${bg} 50%), linear-gradient(to right, ${bgdark} 50%, ${bg} 50%) !important;
background-size: 10px 10px, 10px 10px !important;
}
.label, #company {
color: ${fgintense};
font-size: 0.9em !important;
}
.version, #slogan {
color: ${fg} !important;
font-size: 0.85em !important;
}
.version, #useragent {
font-family: unset !important;
}
#copyright {
font-size: 0.8em !important;
}
a {
color: ${hi};
}
`;
} else if (page === "about:blank") {
var sendit = `
body {
background-image: linear-gradient(to bottom, transparent 50%, ${bg} 50%), linear-gradient(to right, ${bgdark} 50%, ${bg} 50%);
background-size: 10px 10px, 10px 10pt;
}
`;
}
chrome.tabs.insertCSS(id, { code: sendit });
}
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (
changeInfo.url === "chrome://version/" ||
changeInfo.title === "About Version" ||
changeInfo.url === "about:blank"
) {
intpages(tabId, changeInfo.url);
}
});
})();