A New Toy
Sunday, June 8th, 2003I made a style picker for the new site. The idea is to allow the user to choose the font face, font size, text alignment, paragraph indents, page width, and background and text colors for story pages. It’s also useful for previewing fonts and font sizes - I found only one other DHTML viewer with more choices, and it crashed my browser.
Once the preferences are chosen they could be saved in cookies, but that could get to be a lot of cookies. Even more preferences will need to be handled eventually, so I’m leaning towards a database of user preferences. Only the username would need to be saved in a cookie, and that would also spare users the need to configure each new browser and to have javascript enabled.
The style picker is self-contained, so you can see all the css and javascript just by viewing the source. I didn’t type all that - it’s produced by PHP, and you can view the PHP source as well. It’s much easier to add new fonts and colors to the PHP version.
Note that the fonts lean heavily towards OS X system fonts, since those are the ones I had at hand. If a font isn’t available on your system, the associated link will display in your default font. The font classification is not official; particularly, Comic Sans MS isn’t necessarily a fantasy font, but I didn’t want in under sans-serif with the serious, readable fonts.
I put in a selection of color choices, but what the page really needs is a nice tool like the Tigra color picker or Matt Kruse’s color picker. That will require a form on a freestanding preferences page, without the demo text and with a bit more explanation.
For now, it’s just a toy.