Setting QTextBrowser text background color
-
Is it possible to set individual characters background color in QTextBrowser or QTextEdit ?
I don't mean font color of text but different colored background squares under individual characters.
-
Is it possible to set individual characters background color in QTextBrowser or QTextEdit ?
I don't mean font color of text but different colored background squares under individual characters.
@Q139
Untested, but I assume since both of those accept HTML (you're prepared to use that, right?) you can use stylesheet{background-color: ...}around each individual character? Say like:<span style='background-color: red;'>R</span><span style='background-color: green;'>G</span><span style='background-color: blue;'>B</span>...Unless someone else knows better/a better way?
-
@Q139
Untested, but I assume since both of those accept HTML (you're prepared to use that, right?) you can use stylesheet{background-color: ...}around each individual character? Say like:<span style='background-color: red;'>R</span><span style='background-color: green;'>G</span><span style='background-color: blue;'>B</span>...Unless someone else knows better/a better way?
@JonB Thanks for correct syntax , solved.
In syntaxbackgroundwithout-coloralso works. -
@JonB Thanks for correct syntax , solved.
In syntaxbackgroundwithout-coloralso works.@Q139
Assuming QSS is approximately similar to HTML CSS,backgrounddoes a lot more than just set the color: https://developer.mozilla.org/en-US/docs/Web/CSS/background. It so happens thatbackground: green;sets the color alone. I would usebackground-color, no need to abbreviate.