Chris Morley - 2011-06-13

Being able to control the appearance at display time, for instance via CSS, is a nice idea and plays to the strengths of SVG. But it would be tricky to implement immediately because the code for the depiction of molecules is shared with other formats (e.g. PNG) and by the time it gets SVG specific it is just lines and letters (rather than atoms and bonds) being handled. Additional (virtual) functions in the depiction code with different effects for SVG, PNG, etc I think would be necessary.

An alternative available now if the OBMol was being handled in C++ or a scripting language, is to color individual atoms and bonds by attaching an OBPairData object:

OBPairData* dp = new OBPairData;
dp->SetAttribute("color");
dp->SetValue("green");
pAtom->SetData(dp);

I think the Python code would be analogous, but Pybel has no simplified form.