partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
248 stars 61 forks source link

Highlight or select atoms or bonds in viewer? #181

Open cleblond opened 4 years ago

cleblond commented 4 years ago

Is it possible to highlight or show selected atoms or bonds in the viewer? Or maybe easy way to add color to specific atoms, bonds and or molecules in a viewer?

partridgejiang commented 4 years ago

Yes, it is quite simple to set color to object in viewer, e.g.:

atom.setRenderOption('color', 'red');
bond.setRenderOption('color', '#ff0000');
molecule.setRenderOption('color', 'rgb(255,0,0)');
viewer.repaint();