mauriciopoppe / function-plot

A 2d function plotter for the web
https://mauriciopoppe.github.io/function-plot/
MIT License
926 stars 113 forks source link

No option to set plot text color #307

Closed NoahK216 closed 3 months ago

NoahK216 commented 3 months ago

There should be an option to set plot text color.

mauriciopoppe commented 3 months ago

SVG attributes of an element of options.data are customizable through the attr option. Graph wide attributes are also customizable through CSS, which part of the graph in particular isn't customizable?

NoahK216 commented 3 months ago

Yes sorry I should have been more specific. I am having trouble setting the color of the graph title and axis. I have tried to customize this through CSS stylings but I have yet to find a working solution.

Interestingly, with CSS, I am able to set the font-family of the plot text but not color. A working way to modify the title and axis color with CSS would be suitable but I feel an explicit text-color parameter would be better.

For reference all of the text in the below plot is affected by this CSS rule: svg.function-plot text { color: var(--text-primary); font-family: "spotify-circular-book"; } image

mauriciopoppe commented 3 months ago

The axis labels are SVG <text> so they don't have a color property, use fill instead e.g.

<text class="x axis-label" text-anchor="end" x="520" y="334" style="fill: red;">x - axis</text>