harunurhan / react-latex-next

Render LaTeX in React apps
https://react-latex.netlify.app
91 stars 17 forks source link

Compatibility with react version 17 and changing colour #30

Closed dav1d-wright closed 3 years ago

dav1d-wright commented 3 years ago

Hi, and thanks for creating this nice package!

I have found that this package depends on react version 15 or 16, I have managed to install and use it with react version 17 using npm install --force, as another package that I use depends on that version. I reckon it should be possible to just add version 17 to the possible versions in the dependency list.

Also I have a question that I couldn't answer by looking at your code (I'm not really much of a react expert): can you tell me how I could change the font colour of the rendered LaTeX?

harunurhan commented 3 years ago

@dav1d-wright

I added react v17 to the peer deps, you can install v2.1.0 and try it out.

And for the colors, how ever you're styling rest of the your app should work just fine.

For example if you have something like that in your app.

<p>
  <Latex>{aStringWithLaTeX}</Latex>
</p>

You can just do, if you are using CSS

<p className="a-class-name-with-text-color">
  <Latex>{aStringWithLaTeX}</Latex>
</p>

Or if you prefer style prop

<p style={{ color: 'red' }}>
  <Latex>{aStringWithLaTeX}</Latex>
</p>
dav1d-wright commented 3 years ago

Fantastic, thank you very much!