Discussion:
Return SCI_SETSELFORE to default color
m***@gmail.com
2014-07-17 20:53:07 UTC
Permalink
Hi there,

When I create a new Scintilla instance the selection background is a shade
of gray and the foreground color is unchanged. If I change the selection
background color to something else it works as expected. If I call again
SCI_SETSELFORE passing False for useSelectionForeColour my background color
is no longer defined. It's as if it's no color at all, selection does not
display. Per the help, passing false returns it to the default styled
coloring. What is the default styled coloring? Is it possible to return the
color to the default gray without explicitly passing gray for the color?

*SCI_SETSELFORE(bool useSelectionForeColour, int colour
<http://www.scintilla.org/ScintillaDoc.html#colour>)*
*SCI_SETSELBACK(bool useSelectionBackColour, int colour
<http://www.scintilla.org/ScintillaDoc.html#colour>)*
You can choose to override the default selection colouring with these two
messages. The colour you provide is used if you set useSelection*Colour to
true. If it is set to false, the default styled colouring is used and the
colour argument has no effect.

Thanks,
Michael
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-07-17 22:29:45 UTC
Permalink
When I create a new Scintilla instance the selection background is a shade of gray and the foreground color is unchanged. If I change the selection background color to something else it works as expected. If I call again SCI_SETSELFORE passing False for useSelectionForeColour my background color is no longer defined.
I can't reproduce this with current Scintilla.
It's as if it's no color at all, selection does not display.
Are you calling SCI_SETSELBACK(false, ...)?

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Michael Staszewski
2014-07-17 23:30:29 UTC
Permalink
Yes, that's how I'm calling it. I'll do some additional testing
tomorrow to confirm that I'm not doing something funky.

Thanks,
Michael
Post by Neil Hodgson
When I create a new Scintilla instance the selection background is a shade of gray and the foreground color is unchanged. If I change the selection background color to something else it works as expected. If I call again SCI_SETSELFORE passing False for useSelectionForeColour my background color is no longer defined.
I can't reproduce this with current Scintilla.
It's as if it's no color at all, selection does not display.
Are you calling SCI_SETSELBACK(false, ...)?
Neil
--
You received this message because you are subscribed to a topic in the Google Groups "scintilla-interest" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scintilla-interest/rdzjDnCWtN8/unsubscribe.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-07-18 00:23:19 UTC
Permalink
Post by Michael Staszewski
Yes, that's how I'm calling it.
OK, SCI_SETSELBACK(false, ...) is for when you want the selection to only be indicated by the foreground colour, so you call SCI_SETSELBACK(false, ...) and SCI_SETSELFORE(true, ...).

If you want to turn the background colour back on you need to call SCI_SETSELBACK(true, ...) with your preferred colour. The default used by Scintilla is #C0C0C0.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Michael Staszewski
2014-07-18 00:27:45 UTC
Permalink
Excellent. I think that's what I need. I was hoping for an easy (lazy)
approach where I could restore default color to its default state.
I'll assign default colors and all will be well.

Thanks,
Michael
Post by Neil Hodgson
Post by Michael Staszewski
Yes, that's how I'm calling it.
OK, SCI_SETSELBACK(false, ...) is for when you want the selection to only be indicated by the foreground colour, so you call SCI_SETSELBACK(false, ...) and SCI_SETSELFORE(true, ...).
If you want to turn the background colour back on you need to call SCI_SETSELBACK(true, ...) with your preferred colour. The default used by Scintilla is #C0C0C0.
Neil
--
You received this message because you are subscribed to a topic in the Google Groups "scintilla-interest" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scintilla-interest/rdzjDnCWtN8/unsubscribe.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Mike Lischke
2014-07-18 07:23:50 UTC
Permalink
Post by Neil Hodgson
If you want to turn the background colour back on you need to call SCI_SETSELBACK(true, ...) with your preferred colour. The default used by Scintilla is #C0C0C0.
Would be good if Scintilla would query that default color from the platform layer. I've always found the gray irritating, as it looks like the control would be non-active.

Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-07-18 09:43:07 UTC
Permalink
Post by Mike Lischke
Post by Neil Hodgson
The default used by Scintilla is #C0C0C0.
Would be good if Scintilla would query that default color from the platform layer. I've always found the gray irritating, as it looks like the control would be non-active.
This choice dates back to the very early days. On Windows, the default selection colours are white text on strong blue (#3399FF) but most content creation applications do not use this. When Scintilla started it was white on navy. Much of the point of Scintilla was changing the foreground and background colours based on the syntax, so preserving the visibility of the syntax colours in the selection was worthwhile. Choosing a strong background colour interacts badly with some choices of foreground colour.

A light tinted colour may have been better and this was starting to become popular on MacOS, but most PCs had 16 or 256 colour displays so there were not many choices. 256 colour displays were paletted and there were only 20 fixed colours in that palette with a couple of pastel choices in the 4 extra system colours. Choosing a colour that was not in the fixed set could lead to weird and horrible effects when other applications asked for palette entries. Silver, #C0C0C0 was always in the fixed system palette and was a neutral colour so was a safe choice.
http://en.wikipedia.org/wiki/List_of_software_palettes#Microsoft_Windows_default_20-color_palette

I'm open to a good scheme for retrieving a default colour from the system but COLOR_HIGHLIGHT on Windows should not be used.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Mike Lischke
2014-07-19 08:28:35 UTC
Permalink
Post by Neil Hodgson
A light tinted colour may have been better and this was starting to become popular on MacOS, but most PCs had 16 or 256 colour displays so there were not many choices. 256 colour displays were paletted and there were only 20 fixed colours in that palette with a couple of pastel choices in the 4 extra system colours. Choosing a colour that was not in the fixed set could lead to weird and horrible effects when other applications asked for palette entries. Silver, #C0C0C0 was always in the fixed system palette and was a neutral colour so was a safe choice.
http://en.wikipedia.org/wiki/List_of_software_palettes#Microsoft_Windows_default_20-color_palette
I'm open to a good scheme for retrieving a default colour from the system but COLOR_HIGHLIGHT on Windows should not be used.
Well, but that's what this color is defined for. A control should adjust itself to cope with that. I mean it's also a matter for screen readers and disabled people how an application or control presents itself to the user. However, not even MS itself enforces this, e.g. the selection color in Explorer is completely different (in Win7 it's even a gradient). So maybe what you could do is on Win take COLOR_HIGHLIGHT but draw it with an alpha value (say 0.5). That should display fine I think, keeping syntax highlighting well visible. On the other platforms simply use given selection color. On OSX this is already a light color (but definable by the user, one more argument to use the system highlight). No idea about GTK/Qt etc.

Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-07-21 05:05:21 UTC
Permalink
Post by Mike Lischke
So maybe what you could do is on Win take COLOR_HIGHLIGHT but draw it with an alpha value (say 0.5). That should display fine I think, keeping syntax highlighting well visible. On the other platforms simply use given selection color. On OSX this is already a light color (but definable by the user, one more argument to use the system highlight). No idea about GTK/Qt etc.
If anyone want to work on this, it should probably be set inside the Initialise method of the platform-specific subclass of ScintillaBase.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2014-07-18 20:48:01 UTC
Permalink
Thanks, I'm all set now after defining all of my colors.
Post by Michael Staszewski
Yes, that's how I'm calling it.
OK, SCI_SETSELBACK(false, 
) is for when you want the selection to only
be indicated by the foreground colour, so you call SCI_SETSELBACK(false, 
)
and SCI_SETSELFORE(true, 
).
If you want to turn the background colour back on you need to call
SCI_SETSELBACK(true, 
) with your preferred colour. The default used by
Scintilla is #C0C0C0.
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Loading...