Scintilla RGBA64 conversion?

21 views
Skip to first unread message

seasoned_geek

unread,
Sep 6, 2021, 5:20:50 PM9/6/21
to scintilla-interest

All,

Is there something I'm missing in the Scintilla documentation when it comes to whatever RGBA64 format it is using? In particular a method that would cleanly bust it up into the R, G, B, A values?

I'm just being thick headed and stubborn I know, but in example3 I wanted the EDT prompt line to match the edit window like it does in Emacs.

scintilla_color-5.png

They are actually nice and use the comment syntax color for the prompt text and the standard text color for typed information. There are not syntax colors in example3. That will be another couple of examples from now.

What I have currently is the default gray, black, and white one gets under Ubuntu 20.04 LTS, which is fine.

scintilla_color-1.png

I dutifully pulled the values via the method calls and passed them into the function where I dutifully tell CopperSpice (will be much the same if not exactly the same for Qt) this 64-bit value is an RGBA64 value.
scintilla_color-6.png

There are no errors or complaints.
scintilla_color-3.png

A big part of the shaft I'm receiving is the alpha value being 0 (completely translucent). Instead of the "Search for:" prompt followed by an entry field with a white background where typed text appears in black, I get this.

scintilla_color-2.png

It's not a logic error. If I type my text then drag the mouse to select it I can see the text.

scintilla_color-8.png

When I go to this site and key in the RGB values the colors don't seem correct. It's like the default colors aren't ever really set anywhere internally. Everything is set to transparent and somehow the widget "just knows" it is using system colors that it never shares.

So, I guess my questions are thus:
  1. Is there a tool/function for busting this value up properly?
  2. Is my worst fear correct that when you have set no style, all of the values returned by styleFore() styleBack() are deliberately (or regularly) invalid with an alpha of zero for safety?
  3. If 2 is correct, how does one determine what colors are being used or can that only be done if a style has been set?
scintilla_color-9.png

Thanks for taking the time to read.

If you are in America I hope you are having a fantastic Labor Day!

Roland

Neil Hodgson

unread,
Sep 6, 2021, 6:06:03 PM9/6/21
to Scintilla mailing list
seasoned_geek:

> Is there something I'm missing in the Scintilla documentation when it comes to whatever RGBA64 format it is using?

Search for RGBA in ScintilaDoc.html. Its near the top.

Not all values are RGBA, some are RGB.

Neil

Roland Hughes

unread,
Sep 6, 2021, 7:35:55 PM9/6/21
to 'Neil Hodgson' via scintilla-interest
Thanks,

I was looking at that. https://www.scintilla.org/ScintillaDoc.html

====

Colours are set using the RGB format (Red, Green, Blue). The intensity
of each colour is set in the range 0 to 255. If you have three such
intensities, they are combined as: red | (green << 8) | (blue << 16). If
you set all intensities to 255, the colour is white. If you set all
intensities to 0, the colour is black. When you set a colour, you are
making a request. What you will get depends on the capabilities of the
system and the current screen mode.

====

Perhaps I'm just being thick skulled, but that doesn't tell me much.
From that description it sounds like I cannot get the original R G B
values back from the 64-bit value because only 8-bits will have survived.
--
Roland Hughes, President
Logikal Solutions
(630)-205-1593 (cell)
http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com

seasoned_geek

unread,
Sep 7, 2021, 10:18:29 AM9/7/21
to scintilla-interest
I probably need to explain the previous now that I've slept. According to all of the doc from Qt, CopperSpice, etc. RGBA64 has 16-bits for R, G, B, and A. The shifting above is for 8-bits and RGBA32. That's my confusion.

Lex Trotman

unread,
Sep 7, 2021, 8:49:15 PM9/7/21
to scintilla...@googlegroups.com
On Wed, 8 Sept 2021 at 00:18, 'seasoned_geek' via scintilla-interest
<scintilla...@googlegroups.com> wrote:
>
> I probably need to explain the previous now that I've slept. According to all of the doc from Qt, CopperSpice, etc. RGBA64 has 16-bits for R, G, B, and A. The shifting above is for 8-bits and RGBA32. That's my confusion.

Scintilla colours are 8 bits per component as you noted. You can't
pass RGBA64, you have to convert to the RGBA32 format as per the
description you copied below, probably taking the high order 8 bits of
the 16 bit component.

Cheers
Lex
> --
> 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-inter...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/scintilla-interest/145de5a4-a857-491e-b54c-7a7a0daf0519n%40googlegroups.com.

seasoned_geek

unread,
Sep 8, 2021, 5:41:23 PM9/8/21
to scintilla-interest
Is there a way to determine whether Scintilla gave me an RGBA or just an RGB color other than making the assumption Alpha of 0 must be RGB?

Lex Trotman

unread,
Sep 8, 2021, 9:36:41 PM9/8/21
to scintilla...@googlegroups.com
On Thu, 9 Sept 2021 at 07:41, 'seasoned_geek' via scintilla-interest
<scintilla...@googlegroups.com> wrote:
>
> Is there a way to determine whether Scintilla gave me an RGBA or just an RGB color other than making the assumption Alpha of 0 must be RGB?

Scintilla calls return what the API docs say they return, colour (RGB)
(eg https://www.scintilla.org/ScintillaDoc.html#SCI_STYLEGETFORE) or
colouralpha (RGBA) (eg
https://www.scintilla.org/ScintillaDoc.html#SCI_GETELEMENTCOLOUR).

Cheers
Lex

>
> On Monday, September 6, 2021 at 5:06:03 PM UTC-5 Neil Hodgson wrote:
>>
>> seasoned_geek:
>>
>> > Is there something I'm missing in the Scintilla documentation when it comes to whatever RGBA64 format it is using?
>>
>> Search for RGBA in ScintilaDoc.html. Its near the top.
>>
>> Not all values are RGBA, some are RGB.
>>
>> 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-inter...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/scintilla-interest/65779de8-fe29-425b-80f5-af13dba202f3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages