pip install LeoDarkTheme !

139 views
Skip to first unread message

Davy Cottet

unread,
Dec 11, 2014, 5:22:43 AM12/11/14
to leo-e...@googlegroups.com
That a pretty elegant and pythonic way to get a dark theme for leo

(sudo )pip install qdarkstyle


Then in the body of a node and copy the following, then type CTR+B and you get it :)

import qdarkstyle
from leo.core.leoQt import isQt5
if isQt5:
  sheet
= qdarkstyle.load_stylesheet_pyqt5()
else:
  sheet
= qdarkstyle.load_stylesheet(pyside=False)
 
g
.app.gui.frameFactory.masterFrame.setStyleSheet(sheet)


Davy Cottet

unread,
Dec 11, 2014, 5:31:53 AM12/11/14
to leo-e...@googlegroups.com

Here is a screenshot :


Davy Cottet

unread,
Dec 11, 2014, 6:16:16 AM12/11/14
to leo-e...@googlegroups.com
Again, the only problem is the color of log text (log_text_foreground_color) which is always black...

Would it be possible to set it to a qt style sheet value by default, for example same one as outline text color ?

While it's not a Qt value but a Leo's specific one, you'll have to set manually this color in your @settings :
@color log_text_foreground_color = #93a1a1

Edward K. Ream

unread,
Dec 11, 2014, 7:11:03 AM12/11/14
to leo-editor
On Thu, Dec 11, 2014 at 5:16 AM, Davy Cottet <cotte...@gmail.com> wrote:
Again, the only problem is the color of log text (log_text_foreground_color) which is always black...

​Hmm.  I think you have the wrong settings names.  Try changing these settings::

    @color log-fg = black
    @color log-bg = white

Edward

Davy Cottet

unread,
Dec 11, 2014, 7:28:45 AM12/11/14
to leo-e...@googlegroups.com
That's the problem :  both  log-fg and log-bg have no effect at all.

I took me some time to find those log_text_foreground_color (and log_error_color & log_warning_color) that does change the log font color.

So shouldn't that be the correct behavior ?

Edward K. Ream

unread,
Dec 11, 2014, 12:12:15 PM12/11/14
to leo-editor
On Thu, Dec 11, 2014 at 6:28 AM, Davy Cottet <cotte...@gmail.com> wrote:
That's the problem :  both  log-fg and log-bg have no effect at all.

​This is really nasty.  I'm working on it, but it may be awhile...

Edward

Terry Brown

unread,
Dec 11, 2014, 1:43:19 PM12/11/14
to leo-e...@googlegroups.com
On Thu, 11 Dec 2014 11:12:13 -0600
"Edward K. Ream" <edre...@gmail.com> wrote:

> On Thu, Dec 11, 2014 at 6:28 AM, Davy Cottet <cotte...@gmail.com>
> wrote:
>
> > That's the problem : both *log-fg *and* log-bg *have no effect at
> > all.
> >
>
> ​This is really nasty. I'm working on it, but it may be awhile...

Would the shorter route would be starting from Leo's dark
theme...?

I guess the "default theme" should be responsive to settings.

Cheers -Terry

> Edward
>

Edward K. Ream

unread,
Dec 11, 2014, 1:56:57 PM12/11/14
to leo-editor
On Thu, Dec 11, 2014 at 12:43 PM, 'Terry Brown' via leo-editor <leo-e...@googlegroups.com> wrote:
On Thu, 11 Dec 2014 11:12:13 -0600
"Edward K. Ream" <edre...@gmail.com> wrote:

> On Thu, Dec 11, 2014 at 6:28 AM, Davy Cottet <cotte...@gmail.com>
> wrote:
>
> > That's the problem :  both  *log-fg *and* log-bg *have no effect at
> > all.
> >
>
> ​This is really nasty.  I'm working on it, but it may be awhile...

Would the shorter route would be starting from Leo's dark
theme...?

​Don't know.​
 

I guess the "default theme" should be responsive to settings.

​Part of the problem seems to be the settings themselves: they may be applied too late.  I'm looking into it.

Edward

Davy Cottet

unread,
Dec 11, 2014, 2:00:46 PM12/11/14
to leo-e...@googlegroups.com

The only thing I can do now... is sharing another screen-shot to encourage you :)




Edward K. Ream

unread,
Dec 11, 2014, 2:58:18 PM12/11/14
to leo-editor
​​
On Thu, Dec 11, 2014 at 12:56 PM, Edward K. Ream <edre...@gmail.com> wrote:

> ​This is really nasty.  I'm working on it, but it may be awhile...


​Actually, nothing nasty was required, but a copy/paste error caused great confusion.  See the P.S. for details.​

​===== Executive summary

1. rev 5b0b7bc changes the stylesheet entries for the log pane.  This is an improvement, but I doubt it actually was needed.

​2. Use the following settings to specify log colors for a dark theme:

    @color log-fg = white
    @color log-bg = black
    @color log-text-foreground-color = white​

The @color log-fg setting affects the text color of all QTextEdit widgets *except* the log pane.  For example, the panes created by print-settings, etc.

As explained below, the @color log-text-foreground-color setting is required for the log pane.

===== Long-winded explanation

The essence of the situation is that Leo *must* treat the log pane differently.  That's because g.es (and other functions) has a "color" keyword argument.  To make this work, LeoQtLog.put ends up writing log text as html::

    <font color="%s">%s</font>' % (color,s)

This is where @color log-text-foreground-color comes in.  This setting gives the color to be used when either a) no color is given to g.es, or b) the color "black" is given to g.es.

Thus, the @color-fg setting does not affect the text color in the log pane.

Edward

P.S. I copied the name of the setting, log-text-foreground-color, from gmail. Big mistake:  it started with a control character, so it didn't have any effect​. Naturally, that caused massive confusion.  In fact, there was nothing "nasty" about what needed to be done.

EKR

Edward K. Ream

unread,
Dec 11, 2014, 3:00:00 PM12/11/14
to leo-editor
On Thu, Dec 11, 2014 at 1:00 PM, Davy Cottet <cotte...@gmail.com> wrote:

​> ​
The only thing I can do now... is sharing another screen-shot to encourage you :)

​Thanks for this.

Edward

Davy Cottet

unread,
Dec 11, 2014, 3:50:12 PM12/11/14
to leo-e...@googlegroups.com
Yes, that's a bit weird to write g.es('test',color='black') to print it in white :)
Maybe std,warn & err in place of black, blue & red would be less disturbing...

if I understand well, log-fg and log-bg are handled by Qt stylesheet (and so by external themes) but not log-text-foreground-color.
Wouldn't it be possible to set log-text-foreground-color = log-fg  by default for a better theming support ?

However, that's already fine to get a wonderfull dark Leo !

What about adding qdarkstyle to the requirements and set a @settings/@string theme = qdarkstyleor even a submenu to chosse betwenn default/dark/solarized themes  ?
Reply all
Reply to author
Forward
0 new messages