Hi Plucker Team,
I spent some time doing some trial runs on colour support in text documents,
and the results look pretty sharp.
What is the best strategy? So far I was thinking:
Optionally: A command line switch in parser, before parsing a document
telling whether want to do more detailed parsing or fast parsing (or a
colour switch?). Also, a third command line choice could be auto: if the
page starts out with a <meta handheldfriendly="true"> then do detailed
parsing, else skip those sections with an 'if parse good' clause.
Run a stack for color similar to aligns, etc already in the python code.
Handle hexs plus converting standard colours (font colour="green") to hex.
Put the hexs as the value as a forecolor_start, like aligns.
If viewer has been compiled for color, it does something meaningful with
color, else just bypasses it since there is just an empty space in the b&w
source where it hasn't been included.
The viewer end seems pretty straightforward. The forecolour_start function:
if in >8bpp mode (forget the <4bpp, too painful. Also, don't think any way
to get to 8bpp if not OS3.5+, so we have both checks done at once for a
quicker render)
--take the hex RGB next in the doc
--convert RGB to index (for OS 3.5 compatibility: RGB direct starts at OS
4.0+)
--push the current draw state so we can restore them back through the nest
of colour pen switches(thanks Palm!)
--set _both_ the forecolour and the textcolour to the hex RGB (so can
recycle for both text and elements like hr and tables, plus anchors are both
a forecolour draw and text)
forecolour_stop function (again code cut if didn't do a color compile):
--Pop the current draw state to get back to where we were.
Other possibilities:
--In parser: parse the <BODY> tag to get a default value for <a>'s and text
to be used in the rest of the document if no others specified.
--Viewer: visited link change color seems logical in the viewer (though we
already have strike and underline changes to show us). If change color,
provide a way for a document content creator to set this?
--Ignore setting background color of a document?
--Deal with white charactered letters in the parser, so that can't have
white characters on the white Palm screen (since we have ignored document
background colour)?
--Have parser put a slick dark-silver colour before HRs if not otherwise
specified? :)
--Support FORECOLOR as a property. A BACKCOLOR too would be useful too for
the things I am doing, though not as important as forecolor.
--This would be very handy in future stylesheet processing as well as the
current handheld sites that usually do a <font> and <body> tag.
Any comments, suggestions?
Best wishes,
Robert