Possible style overwrite?

121 views
Skip to first unread message

zetah

unread,
Jul 10, 2012, 6:15:31 PM7/10/12
to scite-i...@googlegroups.com
Hi,

I wanted to style scite with mirrored style as in http://ethanschoonover.com/solarized but with slightly different colors, while preserving possibility to quickly switch light/dark background on same foreground style colors.

So I first had a look at various properties files to distill global scheme for "style.*.#" and was surprised that there is no such thing. Various properties use same style number for different definitions.
Searching more I found about "colour.<definition>" property, which I believed would change above observation, but for some reason it doesn't do anything here. For example I commented styles in Python properties and defined this:

  colour.number=fore:#FF0000
  colour.keyword=fore:#00FF00
  colour.string=fore:#0000FF
  colour.char=fore:#FFFF00
  colour.operator=fore:#FF00FF

at the end in my user properties file. I get white foreground (no style at all) for all this definitions.

What could be the problem here?
And if above could work, what other definitions are possible in "colour.<definition>"?
Lastly is there global setting which can overwrite styles defined in various properties files, with the one I set in my user properties file?


Thanks :)

Neil Hodgson

unread,
Jul 10, 2012, 7:28:48 PM7/10/12
to scite-i...@googlegroups.com
zetah:

> So I first had a look at various properties files to distill global scheme for "style.*.#" and was surprised that there is no such thing. Various properties use same style number for different definitions.

Each lexer is different, providing whichever styles are sensible for that language.

> Searching more I found about "colour.<definition>" property, which I believed would change above observation, but for some reason it doesn't do anything here. For example I commented styles in Python properties

With no styles defined for Python, all Python code will appear the same.

> colour.number=fore:#FF0000
> colour.keyword=fore:#00FF00
> colour.string=fore:#0000FF
> colour.char=fore:#FFFF00
> colour.operator=fore:#FF00FF

Without referring to these in lexer-specific style definitions, this will have no effect.

> Lastly is there global setting which can overwrite styles defined in various properties files, with the one I set in my user properties file?

You can define each specific style in your user properties.

Neil

zetah

unread,
Jul 10, 2012, 9:41:36 PM7/10/12
to scite-i...@googlegroups.com
On Wednesday, July 11, 2012 1:28:48 AM UTC+2, Neil Hodgson wrote:

> So I first had a look at various properties files to distill global scheme for "style.*.#" and was surprised that there is no such thing. Various properties use same style number for different definitions.

   Each lexer is different, providing whichever styles are sensible for that language.

That was sad fact to see. All languages share basic lexer types (keyword, number, string, operator, comments...), which could have been defined with first 15-20 style numbers. That would make task of overwriting styles simple as appending new style to each properties file, even if there is not global overwrite property. I imagine that not only styles could have benefit from such scheme

"Grepping" properties files reveals that 3/4 are with less then 20 styles and 90% with less then 30, rest are special cases it seems.


> Lastly is there global setting which can overwrite styles defined in various properties files, with the one I set in my user properties file?

   You can define each specific style in your user properties.

But it will be overwritten from the styles defined in properties files. It seems that it's reasonably impossible to use custom style with scite, that would cover all lexers.

Neil Hodgson

unread,
Jul 10, 2012, 9:53:01 PM7/10/12
to scite-i...@googlegroups.com
zetah:

That was sad fact to see. All languages share basic lexer types (keyword, number, string, operator, comments...), which could have been defined with first 15-20 style numbers.

   Trying to combine styles to match your idea of commonality will miss the distinctions that others find important such as breaking comments into line and stream comments and between doc-comments and other comments. 


But it will be overwritten from the styles defined in properties files. It seems that it's reasonably impossible to use custom style with scite, that would cover all lexers.

   User properties is searched before individual language files imported by global properties.

   Neil

zetah

unread,
Jul 10, 2012, 10:38:45 PM7/10/12
to scite-i...@googlegroups.com
I don't follow both your remarks, but it doesn't matter. Important thing learned is that there is no way for defining custom style for scite without doing it by hand for every lexer .properties file separately.

My initial assumption about "colour.<definition>" property, that supposedly it can be bridge between differently defined lexer style numbers, was wrong because these are just like variables without special meaning, like I hoped.

Cheers

John Yeung

unread,
Jul 10, 2012, 11:05:34 PM7/10/12
to scite-i...@googlegroups.com
> Important thing
> learned is that there is no way for defining custom style for scite without
> doing it by hand for every lexer .properties file separately.

Well, it's true (as far as I know) that you have to override each
properties file separately, but any overrides you do should be done in
your user properties file. This way you keep them all in one place
and you don't have to redo them if you go to a newer version of SciTE.

I admit it is cumbersome to have a set of overrides for each lexer,
but you only have to do it once. I haven't made any major changes to
my properties in years, and the only time I have to do it is when I
start using a new language I haven't used before.

Also, if you want to keep the styles more-or-less consistent across
different lexers, use the symbolic names instead of hex codes. For
example, I've set

# Comment
style.python.1=$(colour.code.comment.line),$(font.comment)
# Number
style.python.2=$(colour.number)
# String
style.python.3=$(colour.string),$(font.monospace)
# Single quoted string
style.python.4=$(style.python.3)
# Keyword
style.python.5=$(colour.keyword)

and so forth. Similarly, any lexer that I use regularly has its
properties overridden in this manner. Now I can change the color of
numbers in all the lexers *that I use* by modifying just
$(colour.number), earlier in my user properties file.

I agree that the design could have been more flexible and easier to
customize. But going back to fix it now would probably be a
tremendous amount of work, and more trouble than it's worth.

John

zetah

unread,
Jul 11, 2012, 3:35:58 PM7/11/12
to scite-i...@googlegroups.com
Thanks for your reply,

I'll just do similar to your suggestion, by adding couple of styles for lexers I use most.

I initially thought to make it for all lexers so that I could share the result, but if there is repetitive task and it can't be automated, generally it's not worth the effort.
I tried regex on properties files to grab commented line above style definitions and match it with general lexer types. I got nice table on which I can work, but for completion I'll need to do more work for the rest of unmatched styles. If I have patience

OTOH "colour.<definition>" variables are really nice idea for solving this problem, also allowing user not to dig in various aspects of particular language to determine what should be treated here as keyword and similar. But not yet all lexer properties files are using those variables
Reply all
Reply to author
Forward
0 new messages