|
|
@@ -62,7 +62,7 @@ struct WebIndex{
|
|
|
TitleBar({model:$titleBarModel})
|
|
|
Progress({ value: 0, total: 100, type: ProgressType.Linear })
|
|
|
.backgroundColor(this.isDarkMode ? 0x333333 : 0xFFFFFF)
|
|
|
- .color(this.isDarkMode ? 0x6666FF : 0x414AFF)
|
|
|
+ // .color(this.isDarkMode ? 0x6666FF : 0x414AFF)
|
|
|
.value(this.progressValue)
|
|
|
.width('%100')
|
|
|
.height(2)
|
|
|
@@ -77,12 +77,35 @@ struct WebIndex{
|
|
|
.domStorageAccess(true)
|
|
|
.margin({bottom:20})
|
|
|
.backgroundColor(this.isDarkMode ? 0x1A1A1A : 0xFFFFFF)
|
|
|
+ .darkMode(this.isDarkMode ? WebDarkMode.On : WebDarkMode.Off)
|
|
|
+ // .textZoom(100)
|
|
|
.onProgressChange((event)=>{
|
|
|
if (event) {
|
|
|
console.log('newProgress:' + event.newProgress);
|
|
|
this.progressValue = event.newProgress
|
|
|
}
|
|
|
})
|
|
|
+ .onPageEnd(() => {
|
|
|
+ if (this.isDarkMode) {
|
|
|
+ this.webController.runJavaScript(`
|
|
|
+ document.body.style.color = '#FFFFFF';
|
|
|
+ document.body.style.backgroundColor = '#1A1A1A';
|
|
|
+ document.querySelectorAll('*').forEach(element => {
|
|
|
+ element.style.color = '#FFFFFF';
|
|
|
+ if (element.tagName === 'A') {
|
|
|
+ element.style.color = '#1E90FF';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const style = document.createElement('style');
|
|
|
+ style.textContent = \`
|
|
|
+ body { color: #FFFFFF !important; background-color: #1A1A1A !important; }
|
|
|
+ p, div, span, h1, h2, h3, h4, h5, h6 { color: #FFFFFF !important; }
|
|
|
+ a { color: #1E90FF !important; }
|
|
|
+ \`;
|
|
|
+ document.head.appendChild(style);
|
|
|
+ `);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|