[Laszlo-dev] dguide: Color chapter
P T Withington
ptw at pobox.com
Fri Nov 14 08:17:50 PST 2008
I like your example. The reason your toString doesn't work is deep.
I tried another way, but that is broken. I'm going to file a bug and
send around a change with your example as the test case... hang on.
On 2008-11-14, at 09:42EST, Lou Iorio wrote:
>
> On Nov 13, 2008, at 1:17 PM, P T Withington wrote:
>
>> Basically, using '0x000000' in CSS was a kludge, non-standard, and
>> probably should have been documented as such. It will cause a
>> deprecation warning.
>>
>> Any of the other 3 methods are standard, acceptable, and work.
>>
>> It would be fine with me if we just said that you specified colors
>> the same as the CSS standard.
>>
>> You can specify your color as a numeric value also, the result of a
>> computation, it doesn't need to be expressed as a hex constant.
>
> I'll add this to the chapter. I'd like to include a simple example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <canvas>
> <simplelayout spacing="5"/>
> <view id="swatch" width="300" height="100" bgcolor="$
> {color.value}" />
> <view id="sliders">
> <simplelayout />
> <slider id="color" width="300" value="0" minvalue="0"
> maxvalue="16777215"/>
> <text text="${color.value}" />
> </view>
> </canvas>
>
> Is this worth including? My intent for the last <text> tag was to
> print the hex equivalent
> of the slider value, but I can't figure out how to do that. I tried:
>
> <text text="${color.value.toString(16)}" />
>
> but that doesn't work. Any ideas? Better example?
>
> Thanks,
>
> Lou
>
>>
>>
>> On 2008-11-13, at 08:49EST, Lou Iorio wrote:
>>
>>> The text preceding Example 20.3. Coloring text using CSS seems to
>>> completely contradict what the example shows.
>>>
>>> The text says:
>>>
>>> OpenLaszlo enables coloring in four ways: 0x000000, #000000,
>>> rgb(0,0,0), and "black". For now, the best reason to prefer to use
>>> the hex style 0x000000 is that it always works, whether the color
>>> is assigned explicitly within the view, or by stylesheet. Color
>>> assignment by stylesheet fails by name, #hex, or rgb(). Explicit
>>> color assignment by rgb() fails unless the RGB values are all
>>> numerals -- that is, rgb(0,0,0) produces black, but rgb(FF,FF,FF),
>>> which should produce white, comes back at compile time as an
>>> invalid color.
>>>
>>> Coloring of text with fgcolor="foo" is enabled in the same
>>> fashions, but with the same limitations.
>>>
>>> CSS spits out an error if you use 0x000000. How about:
>>>
>>> OpenLaszlo enables coloring in four ways: 0x000000, #000000,
>>> rgb(0,0,0), and "black". Using the format 0x000000 only works for
>>> explicit assignment; it does not work in CSS. Color assignment
>>> using rgb() must be specified with decimal values from 0 - 255.
>>>
>>> Coloring of text with fgcolor="foo" is enabled in the same
>>> fashions, but with the same limitations.
>>>
>>> In addition, the title of the example, "Coloring text using CSS",
>>> might be better if changed to "Applying color explictly and with
>>> CSS" since it shows coloring views as well as text.
>>>
>>> If you agree (or have a better idea), I'll make the changes.
>>>
>>> Lou
>>
>
More information about the Laszlo-dev
mailing list