Yomguithereal / react-blessed

A react renderer for blessed.
MIT License
4.45k stars 177 forks source link

Confusion regarding styling text #93

Open TJohnW opened 5 years ago

TJohnW commented 5 years ago

Hey, I'm hoping you could clear up some confusion I have around how text nodes are handled. Is the intent to always set styling on a text element and explicitly set the content prop of that element? I think I was expecting string child nodes to be set as the content of the parent.

<text fg="green">I'm not green!</text>
...
<text fg="green" content="I'm green!" />

I also tried to style my text nodes using the tag syntax but found that didn't work either:

<text bg="black">
  {`{blue-fg}Hello World!{/}`}
</text>

It looks like the latter can be accomplished by setting tags: true when react-blessed internally creates the text instances here https://github.com/Yomguithereal/react-blessed/blob/master/src/fiber/fiber.js#L102