Unavoidable style settings

41 views
Skip to first unread message

Edward K. Ream

unread,
Mar 6, 2018, 9:17:42 AM3/6/18
to leo-editor
Just a quick note.  Some stylesheet-related settings must remain, and some new ones added!

- Syntax coloring settings must remain because they are not used in the css.

- New settings must be added because Leo's core needs to do a "text coloring switcheroo".

For example, Leo's core assumes g.es(message,color='blue') will be visible.  That's dubious in a dark theme.

For dark themes we would like to change 'blue' to 'solarized-blue'.  To make this happen, there probably needs to be new settings, something like this:

    @color es_blue_color = @solarized-blue
    @color es_red_color = @solarized-red

etc.  And so it goes...

Edward

Terry Brown

unread,
Mar 6, 2018, 9:29:54 AM3/6/18
to leo-e...@googlegroups.com
On Tue, 6 Mar 2018 06:17:42 -0800 (PST)
"Edward K. Ream" <edre...@gmail.com> wrote:

> @color es_blue_color = @solarized-blue
> @color es_red_color = @solarized-red

Please please please

@color es_info_color = @solarized-blue
@color es_error_color = @solarized-red

:-)

Cheers -Terry

Terry Brown

unread,
Mar 6, 2018, 9:32:12 AM3/6/18
to leo-e...@googlegroups.com
Although even better:

@color log_info_color = @solarized-blue
@color log_error_color = @solarized-red

I really don't know what es stands for, emit string maybe? It always
makes me think of Spanish.

Cheers -Terry

jkn

unread,
Mar 6, 2018, 10:29:45 AM3/6/18
to leo-editor


On Tuesday, March 6, 2018 at 2:32:12 PM UTC, Terry Brown wrote:
[...]
 
I really don't know what es stands for, emit string maybe?  It always
makes me think of Spanish.

Yes - it is weird that pretty much the first scripting function you would try in Leo:

    g.es("Hello Leonine World")

has a name that no-one seems to know what it means!

If it didn't originally stand for 'Emit String' then I think it should be made to do so now, by fiat, and a note put in the docs and cheat sheet to that effect.

    J^n

Edward K. Ream

unread,
Mar 6, 2018, 11:52:00 AM3/6/18
to leo-editor
On Tue, Mar 6, 2018 at 8:32 AM, Terry Brown <terry...@gmail.com> wrote:

Although even better:

      @color log_info_color = @solarized-blue
      @color log_error_color = @solarized-red

​I'll use log_ instead of es_ as you prefer.

It just won't work to use info/error instead of blue/red, for several ​reasons.

1. I omitted a crucial "etc."  We need settings for all the common tk/solarized colors: red, blue, yellow, green. Iirc, Leo's core only uses blue and red, but mod_http uses purple and we might as well give the entire range of (at least) solarized names.

2. Using error/info would be just plain wrong. Error and info mean nothing in Leo. Yes, various error/warning/info methods exist, but they use tk/solarized colors, and it is those colors that we have to redirect.

Anyway, LeoQtLog.put must be extended.  It presently contains this:

if color:
     color
= leoColor.getColor(color, 'black')
else:
     color
= leoColor.getColor('black')

We must translate this "preliminary color" using the new settings by adding something like this (untested):

d = {
   
'black': 'log_black_color',
   
'red': 'log_red_color',
   
... # etc.!
}
setting
= d.get(color)
if setting:
    color2
= c.config.getColor(setting)
   
if color2:
        color
= leoColor.getColor(color, color)

I am about to summarize our recent discussions in a new thread.  As always, they have been fruitful.

Edward

Terry Brown

unread,
Mar 6, 2018, 12:09:27 PM3/6/18
to leo-e...@googlegroups.com
On Tue, 6 Mar 2018 08:52:00 -0800 (PST)
"Edward K. Ream" <edre...@gmail.com> wrote:

> 2. Using error/info would be just plain wrong. Error and info mean
> *nothing* in Leo. Yes, various error/warning/info methods exist, but
> they use tk/solarized colors, and it is *those* colors that we have
> to redirect.

Maybe this would be a good time to fix the API then. Log messages
should clearly be tagged with semantic names like "error" or "warning",
and not "blue", unless specifically for errors that make you feel
morose :-)

I agree with this guy:

https://groups.google.com/d/msg/leo-editor/YhxOvssBOKU/mnXy9lEQPsIJ

:-)

So good that g.error and g.warning exist, although I'd also like to see
g.log() not be "Write a message to ~/test/leo_log.txt.", and to support
type='warning", etc.

Cheers -Terry

Edward K. Ream

unread,
Mar 6, 2018, 1:38:50 PM3/6/18
to leo-editor
On Tue, Mar 6, 2018 at 11:09 AM, Terry Brown <terry...@gmail.com> wrote:

> 2. Using error/info would be just plain wrong. Error and info mean
> *nothing* in Leo. Yes, various error/warning/info methods exist, but
> they use tk/solarized colors, and it is *those* colors that we have
> to redirect.

Maybe this would be a good time to fix the API then.  Log messages
should clearly be tagged with semantic names like "error" or "warning",
and not "blue", unless specifically for errors that make you feel
morose :-)

​Imo, the way forward is to add error, info, warning to the list of colors that can be redirected.

As you imply, we could change color="red" to color="error"/"warning" in various places in Leo's core.  But for compatibility we must still support the "hard" colors.

I have just added #788: Add support for themes for all this.

Edward
Reply all
Reply to author
Forward
0 new messages