[Laszlo-dev] dguide: Color chapter
André Bargull
andre.bargull at udo.edu
Wed Nov 19 09:38:54 PST 2008
These RegEx' from ViewSchema are responsible for the color-parsing, right?
> Perl5Compiler compiler = new Perl5Compiler();
> String s = "\\s*(-?\\d+(?:(?:.\\d*)%)?)\\s*"; // component
> String hexDigit = "[0-9a-fA-F]";
> String hexByte = hexDigit + hexDigit;
> sRGBPattern = compiler.compile("\\s*rgb\\("+s+","+s+","+s+"\\)\\s*");
> sHex3Pattern = compiler.compile("\\s*#\\s*(" + hexDigit + hexDigit +
> hexDigit + ")\\s*");
> sHex6Pattern = compiler.compile("\\s*#\\s*(" + hexByte + hexByte +
> hexByte + ")\\s*");
> Add that to the bug.
>
> Clearly the parser sux.
>
> Also, I discovered that if I say:
>
> bgcolor="${iceblue}"
>
> and iceblue is not defined in lz.colors, I get:
>
> #000ceb
>
> as my color. As in iCEBlue. It's like the parser is trying to find a
> hex string in there somewhere, and skipping over any initial non-hex
> characters. That seems pretty counter-intuitive to me, it not dead
> wrong.
>
> On 2008-11-19, at 11:25EST, Lou Iorio wrote:
>
> >/ Ah, I see: you need to specify 0% as 00%. Curiously, you can have
> />/ values
> />/ over 100%. 1000% looks the same as 100%.
> />/
> />/ On Nov 19, 2008, at 11:57 AM, Lou Iorio wrote:
> />/
> />>/ Are there restrictions on the values you use for %?
> />>/
> />>/ This works:
> />>/
> />>/ <view width="50" height="50" bgcolor="rgb(13%,10%,60%)"/>
> />>/
> />>/ but this:
> />>/
> />>/ <view width="50" height="50" bgcolor="rgb(13%,0%,60%)"/>
> />>/
> />>/ gives me this error:
> />>/
> />>/ Invalid value for bgcolor on LzSprite for view [50.00 x
> />>/ 50.00]*[1.00 0 0.00, 0 1.00 0.00, 0 0 1]: (void 0)
> />>/
> />>/ Ditto, it seems, for any value under 10%.
> /
More information about the Laszlo-dev
mailing list