Override line background and foreground

95 views
Skip to first unread message

Jordan Russell

unread,
Oct 1, 2010, 1:27:46 AM10/1/10
to scintilla...@googlegroups.com
Hello,

I'm currently using the SC_MARK_BACKGROUND marker type to highlight
errors, breakpoints, etc.

The problem I have is that if the background color for the marker
happens to be similar to some of the foreground colors used to style
text, the text can become unreadable.

To prevent that from happening, I would like to override the text color
as well.

At first I thought I might be able to accomplish that by applying a
special style to the lines, but that affects the fonts used as well as
the colors.

Essentially I'm looking for the marker equivalent of SCI_SETSELFORE: I
want to apply a special foreground color to the text on a line but still
keep all of the usual fonts, bolding, etc.

Is there some way of doing this that I'm just missing?

Thanks.
--
Jordan Russell

Neil Hodgson

unread,
Oct 1, 2010, 3:39:29 AM10/1/10
to scintilla...@googlegroups.com
Jordan Russell:

> Essentially I'm looking for the marker equivalent of SCI_SETSELFORE: I
> want to apply a special foreground color to the text on a line but still
> keep all of the usual fonts, bolding, etc.

There is no support for this.

Neil

Jordan Russell

unread,
Oct 1, 2010, 4:48:19 PM10/1/10
to scintilla...@googlegroups.com

Okay, thanks.

Would you accept a patch that adds this feature? Attached is what I've
come up with so far; seems to be working fine.

--
Jordan Russell

SC_MARK_BACKFORE-patch.txt

Neil Hodgson

unread,
Oct 3, 2010, 8:34:32 PM10/3/10
to scintilla...@googlegroups.com
Jordan Russell:

> The problem I have is that if the background color for the marker
> happens to be similar to some of the foreground colors used to style
> text, the text can become unreadable.
>
> To prevent that from happening, I would like to override the text color
> as well.

But then you lose all the information from the text foreground
colouring. Wouldn't you be better off setting an alpha value so that
you can still see the different text colours?

Neil

Jordan Russell

unread,
Oct 5, 2010, 4:00:25 PM10/5/10
to scintilla...@googlegroups.com

I spent a lot of time experimenting with various alpha settings, and
with just lighter background colors, but never managed to achieve a
totally satisfactory result.

I suppose some screen shots would help explain things:
http://www.jrsoftware.org/images/scintillascrn.png

Image 1: This is how my editor looked pre-Scintilla. The classic
"Borland IDE" colors are used to highlight error lines and breakpoints.

Image 2: This is what happens if I try to use the same background colors
in Scintilla but without overriding the foreground colors.

Image 3: This is with an alpha of 128. It's an improvement but the black
text is still a bit difficult to make out.

Image 4: Only by using a very low alpha like 32 does the text, in my
opinion, become fairly readable.

But the light pink just isn't working for me. :)

--
Jordan Russell

Neil Hodgson

unread,
Oct 8, 2010, 8:11:24 AM10/8/10
to scintilla...@googlegroups.com
Perhaps a better factoring would be a marker that sets the
foreground colour of the text so that you could set either the
foreground or background with one marker or both the foreground and
background by setting two markers on the line.

Neil

Reply all
Reply to author
Forward
0 new messages