Add ability to change document's default background and text color
This commit is contained in:
parent
78f23db211
commit
c8dd22817a
@ -1,3 +1,9 @@
|
||||
[default]
|
||||
home = https://example.com
|
||||
useragent = BirdyNet/$VER ($OS)
|
||||
useragent = BirdyNet/$VER ($OS)
|
||||
|
||||
[accessibility]
|
||||
# Which background color (CSS color) should be chosen for websites? "default" for system's default. "white" is recommended for compatibility.
|
||||
colorBackground = white
|
||||
# Which text color (CSS color) should be chosen for websites? "default" for system's default. "black" is recommended for compatibility.
|
||||
colorText = black
|
@ -3,7 +3,14 @@ class browserDoc(QTextBrowser):
|
||||
def __init__(self,*args,**kwargs):
|
||||
super().__init__(*args,**kwargs)
|
||||
self.setOpenLinks(False)
|
||||
self.setStyleSheet("QTextBrowser { background-color: white; color: black }")
|
||||
style = ""
|
||||
if (config["accessibility"]["colorBackground"] != "default"):
|
||||
style += "background-color: " +config["accessibility"]["colorBackground"] + ";"
|
||||
|
||||
if (config["accessibility"]["colorText"] != "default"):
|
||||
style += "color: " +config["accessibility"]["colorText"]+ ";"
|
||||
|
||||
self.setStyleSheet("QTextBrowser { " +style+ " }")
|
||||
self.anchorClicked.connect(self.cAnchorClicked)
|
||||
|
||||
def cRenderHtml(self,html):
|
||||
|
Loading…
Reference in New Issue
Block a user