Current Line Highlighting Is Now Available In The Devel Branch

27 views
Skip to first unread message

tbp1...@gmail.com

unread,
Sep 15, 2021, 9:13:40 AM9/15/21
to leo-editor
Highlighting of the body line the cursor is now in the latest version of the devel branch. Highlighting is turned off by default.  To turn it on, add a setting to myLeoSettings.leo, or to an outline in which you want to try it out.  The setting is:

@bool highlight-body-line = True

By default, the highlight color will be computed based on the background color of your theme.  If you do not like the computed color, you can override it with another setting:

@string line-highlight-color = yourcolor

Instead of yourcolor,  use the CSS color you want.  Valid css colors are standard css color names like aliceblue, lightgrey, etc. You can also use css rgb color values like #1253da. If the color is not a valid css color, black will be used, which is not likely to be a good highlight color. (Note that the allowed color names are those known to Qt, and may not include the full range used by browsers).

The Help/Open Help topics menu has a new entry Help-For-Highlight-Current-Line  that displays this information about the color settings.

tbp1...@gmail.com

unread,
Sep 15, 2021, 9:30:25 AM9/15/21
to leo-editor
For those interested in how the background color is computed, here is the algorithm:

1. Parse the Leo theme's style sheet and extract the body text foreground and background colors.
2. If the theme has a light background, use a slightly darker color; if the theme bg is dark, use a slightly lighter color.  Keep the hue the same, only changing the intensity (change only V in the HSV triple).  If the bg color is not specified, guess based on the fg color (currently this is a very simple minded guess)..
3. If the theme's bg color is very dark, use a larger change in intensity than otherwise (because the minimum perceptible change seems to be larger in the V value for very dark colors).

Please let us know how the highlighting works for you!

Viktor Ransmayr

unread,
Sep 16, 2021, 1:38:34 PM9/16/21
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Mittwoch, 15. September 2021 um 15:30:25 UTC+2:
For those interested in how the background color is computed, here is the algorithm:

1. Parse the Leo theme's style sheet and extract the body text foreground and background colors.
2. If the theme has a light background, use a slightly darker color; if the theme bg is dark, use a slightly lighter color.  Keep the hue the same, only changing the intensity (change only V in the HSV triple).  If the bg color is not specified, guess based on the fg color (currently this is a very simple minded guess)..
3. If the theme's bg color is very dark, use a larger change in intensity than otherwise (because the minimum perceptible change seems to be larger in the V value for very dark colors).

Please let us know how the highlighting works for you!

Works like a charm for me.

On Wednesday, September 15, 2021 at 9:13:40 AM UTC-4 tbp1...@gmail.com wrote:
Highlighting of the body line the cursor is now in the latest version of the devel branch. Highlighting is turned off by default.  To turn it on, add a setting to myLeoSettings.leo, or to an outline in which you want to try it out.  The setting is:

@bool highlight-body-line = True

By default, the highlight color will be computed based on the background color of your theme.  If you do not like the computed color, you can override it with another setting:

@string line-highlight-color = yourcolor

Instead of yourcolor,  use the CSS color you want.  Valid css colors are standard css color names like aliceblue, lightgrey, etc. You can also use css rgb color values like #1253da. If the color is not a valid css color, black will be used, which is not likely to be a good highlight color. (Note that the allowed color names are those known to Qt, and may not include the full range used by browsers).

The Help/Open Help topics menu has a new entry Help-For-Highlight-Current-Line  that displays this information about the color settings.

Thanks a lot for adding this visual improvement.

With kind regards,

Viktor

tbp1...@gmail.com

unread,
Sep 16, 2021, 4:56:14 PM9/16/21
to leo-editor
:) Thank you, Viktor!
Reply all
Reply to author
Forward
0 new messages