On color representation again

88 views
Skip to first unread message

Alexei Barantsev

unread,
Sep 14, 2015, 7:20:19 AM9/14/15
to Selenium Developers
Hi, devs,

We have got color representation issue again.

The W3C standard tends to require RGB format for colors following another W3C standard css3-color, see [1] and [2].

But the current client API is designed to return colors in RGBa format, see [3].

So we have a questions: are we going to change the client API to conform to the standard too?


Regards,
-- 
Alexei Barantsev
Software-Testing.Ru
Selenium2.Ru

David Burns

unread,
Sep 14, 2015, 7:49:22 AM9/14/15
to selenium-...@googlegroups.com, Selenium Developers
My vote is to follow the standard. It is a web standard and we are supposed to be driving the web. 

David


Sent from Mailbox


--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-developers/6ed2a8c1-0690-4167-9ffb-57910da75ef5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

alex...@gmail.com

unread,
Sep 14, 2015, 12:37:34 PM9/14/15
to Selenium Developers
OK but what is the standard? The second link--http://www.w3.org/TR/css3-color/#rgb-color--states:

4.2.2. RGBA color values

The RGB color model is extended in this specification to include “alpha” to allow specification of the opacity of a color.


...and I think having transparent/semi-transparent colors is a fairly key feature of the web, no?

On Monday, September 14, 2015 at 1:49:22 PM UTC+2, David Burns wrote:
My vote is to follow the standard. It is a web standard and we are supposed to be driving the web. 

David


Sent from Mailbox


On Mon, Sep 14, 2015 at 12:20 PM, Alexei Barantsev <bara...@gmail.com> wrote:

Hi, devs,

We have got color representation issue again.

The W3C standard tends to require RGB format for colors following another W3C standard css3-color, see [1] and [2].

But the current client API is designed to return colors in RGBa format, see [3].

So we have a questions: are we going to change the client API to conform to the standard too?


Regards,
-- 
Alexei Barantsev
Software-Testing.Ru
Selenium2.Ru

--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developers+unsub...@googlegroups.com.

Mark Collin

unread,
Sep 28, 2015, 11:31:42 AM9/28/15
to Selenium Developers
The question is what should you return if there is an opacity set.

rgb(0,0,0) is very different to rgba(0,0,0,0)  (One is black, one is totally transparent).

You could return RGB unless an opacity is set and then return RGBA, but having different returns in different conditions is confusing.  I know Java has a utility class to convert between different colours which makes it easier to take an RGBA value and then switch to to RGB or HEX.  Do the other language bindings have this as well?

If not would the pragmatic approach be to provide this helper class for all language bindings?

Andreas Tolfsen

unread,
Oct 4, 2015, 1:50:52 PM10/4/15
to selenium-...@googlegroups.com
On 28 Sep 2015, at 16:31, Mark Collin <fyre...@gmail.com> wrote:
> The question is what should you return if there is an opacity set.
>
> rgb(0,0,0) is very different to rgba(0,0,0,0) (One is black, one is
> totally transparent).
>
> You could return RGB unless an opacity is set and then return RGBA,
> but having different returns in different conditions is confusing.

The specification will mandate that we return the resolved CSS
property value, without any coercion on the driver side.

This means

<p style="color: rgb(0,0,0)">rgb(0,0,0)
<p style="color: black">black
<p style="color: rgba(0,0,0,0)">rgba(0,0,0,0)

will return something like

window.getComputedStyle(ps[0]).color
"rgb(0, 0, 0)"
window.getComputedStyle(ps[1]).color
"rgb(0, 0, 0)"
window.getComputedStyle(ps[2]).color
“rgba(0, 0, 0, 0)"

> I know Java has a utility class to convert between different colours
> which makes it easier to take an RGBA value and then switch to to RGB
> or HEX. Do the other language bindings have this as well?


Not all language bindings have these utilities.

> If not would the pragmatic approach be to provide this helper class
> for all language bindings?

I think so. To quote an ancient hacker proverb, patches welcome!

Andreas Tolfsen

unread,
Oct 4, 2015, 1:52:02 PM10/4/15
to selenium-...@googlegroups.com
On 14 Sep 2015, at 17:37, alex...@gmail.com wrote:
> OK but what is the standard? The second
> link--http://www.w3.org/TR/css3-color/#rgb-color--states:


The relevant prose is http://dev.w3.org/csswg/cssom/#resolved-values.

Reply all
Reply to author
Forward
0 new messages