[PATCH weston 1/2] config-parser: add support for more color formats

Bryce Harrington bryce at osg.samsung.com
Fri Oct 21 23:04:00 UTC 2016


On Fri, Oct 21, 2016 at 04:02:15PM +0100, Eric Engestrom wrote:
> On Friday, 2016-10-21 12:30:07 +0200, Quentin Glidic wrote:
> > Hi,
> > 
> > On 20/10/2016 00:08, Eric Engestrom wrote:
> > > Valid colours start with an optional '0x' or '#', followed by:
> > > - AARRGGBB
> > > -   RRGGBB
> > > -  A R G B
> > > -    R G B
> > > -   XYXYXY
> > > -   XXXXXX
> > 
> > I think this is way too much, even with minimal code effort.
> > 
> > The well-known CSS formats are #RRGGBB and #RGB, and the backward-compatible
> > extension are #RRGGBBAA and #RGBA.
> > The current 0xAARRGGBB are directly derived from the internal usage of a
> > colour as a number, because Weston devs are used to this. But *users* are
> > not, they are used to CSS notation.
> > 
> > IMO, 0x should be used as-is, with a little clamping, so the old way
> > continue to work. OTOH, the # notation should be fully compatible with CSS.
> > 
> > This code would lead to user-unexpected behaviour, and it’s easy to avoid
> > that.
> 
> You're right, I didn't really think this through :)
> I'll send a v2 with only commonly used formats/orders when
> I have some more time (probably sunday):
> 
> - (0x)(AA)RRGGBB (backward compatibility)
> - #RGB(A)
> - #RRGGBB(AA)
> 
> Bryce, I think you wanted a single repeating char format; do you also
> want the 2-char format?

I agree with Quentin that it's probably most important that color codes
are handled in consistent ways so that they don't encounter odd
unexpected behaviors.  In that light less maybe more as they say.

Bryce


More information about the wayland-devel mailing list