Search code examples
pythonlatexdrawingpyx

Pyx have a curve and its curve text have different colors


Silly question but, I have the following pyx diagram:

enter image description here

I want the text in the edges to be black but the edges themselves to stay red.

This is my code:

   c.stroke(path.line(p1[0], p1[1], p2[0], p2[1]),
        [
            style.linecap.round, color.rgb(tcolor[0], tcolor[1], tcolor[2]),
            deco.curvedtext(f"\huge{{{label}}}", textattrs=[text.halign.center],
            exclude=0.1)
        ])

Solution

  • Just figured it out:

    c.stroke(path.line(p1[0], p1[1], p2[0], p2[1]),
        [
            style.linecap.round, color.rgb(tcolor[0], tcolor[1], tcolor[2]),
            deco.curvedtext(f"\huge{{{label}}}", textattrs=[text.halign.center, color.rgb.black],
            exclude=0.1)
        ])