Refactor CSS from templates into external file; minify into dist file.
Add a config option to legends to allow HTML in them.