Re: [code] [textadept] Theme enhancements in hg

From: Mitchell <m.att.foicica.com>
Date: Wed, 15 Jul 2020 10:02:15 -0400 (EDT)

Hi Robert,

On Wed, 15 Jul 2020, Robert Gieseke wrote:

> On 15.07.20 15:01, Mitchell wrote:
>>
>> Are you asking if there's a way to override colors and styles from the table? If so, there isn't one. I wasn't aware that was a thing.
>
> I was thinking of changes like this:
>
> events.connect(events.LEXER_LOADED, function(lexer)
> if lexer ~= 'java' then return end
> local default_fore = view.style_fore[view.STYLE_DEFAULT]
> view.style_fore[buffer:style_of_name('function')] = default_fore
> end)
>
> https://foicica.com/hg/textadept/diff/9d1d413a6edc/doc/manual.md#l1.53
>
> Does that only work with LEXER_LOADED?

No, it will work anywhere post-init. You can put it in `events.BUFFER_NEW`, `events.VIEW_NEW`, and `events.INITIALIZED` handlers, in a keybinding, etc.

If you want to be more general, you can do something like:

   lexer.colors.aqua = ...
   lexer.styles.keyword = {fore = lexer.colors.aqua, bold = true}

(The manual gives a very specific, targeted example to showcase finely-tuned style changes.)

The only time this doesn't work is during initialization (e.g. directly in *~/.textadept/init.lua*), because the `lexer` object doesn't exist yet until the first buffer is created.

Remember that you can always create your own theme that has:

   dofile('/path/to/theme/you/like')

   lexer.colors.whatever = my_custom_color
   lexer.styles.whatever = my_custom_style

By the way, if all this doesn't work now, it should soon after I commit some local changes.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 15 Jul 2020 - 10:02:15 EDT

This archive was generated by hypermail 2.2.0 : Thu 16 Jul 2020 - 06:35:57 EDT