Add text

Text labels are 2D, screen-aligned markers you can attach to arbitrary positions. They do not rotate with the 3D scene.

[1]:
from ase.build import molecule
from weas_widget import WeasWidget
atoms = molecule("C2H6SO")
viewer = WeasWidget()
viewer.from_ase(atoms)
viewer.avr.model_style = 1
viewer.text.settings = [
    {
        "positions": [atoms.positions[0]],
        "texts": "here!",
        "color": "#ff0000",
        "fontSize": "18px",
        "className": "text-label",
        "renderMode": "shape",
    },
    {
        "positions": [atoms.positions[1], atoms.positions[2]],
        "texts": "x",
        "color": "#111111",
        "fontSize": "32px",
        "className": "text-label",
        "renderMode": "shape",
    },
]
viewer
[1]: