question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change label font color

See original GitHub issue

I simply want to change the color of the text in the label but i don’t know with property to use…

for example if I want to use a white color for the font in the label I am trying this:

const whiteLabel = ({ x, y, stroke, value }) => {
  return (
    <div style={{ color: '#FFFFFF' }}>
      <text x={x} y={y} dy={-4} fill={stroke} fontSize={10} textAnchor="middle">{value}</text>);
    </div>
  );
};

which is WRONG…

How to fix this?

Thanks, Alessandro

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

59reactions
peterbartoscommented, May 29, 2019

The key is not to use color style but fill style. E.g.:

<Label angle={270} position='insideLeft' offset={10}
    value=" TA / Pouls"
    style={{ textAnchor: 'middle', fontSize: '80%', fill: 'rgba(0, 0, 0, 0.87)' }}>
30reactions
xile611commented, Jun 9, 2017

@sun2rise Use svg nodes not html nodes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change label color with html and CSS without js?
You can use the CSS 'starts with' attribute selector ( ^= ) to select all labels with a for attribute that starts with...
Read more >
How To Change Label Color With Html And CSS Without Js?
html label text color – CSS background-color property sets the background color of an element. To set the font color in HTML, use...
Read more >
How to set font color in HTML?
We use the style attribute to set the font color in HTML. The style attribute specifies an inline style for an element, with...
Read more >
How may I change the font color of my labels (I already ...
Using mail.google.com, where you change the label color, select "Add custom color". Here you can change both the background and text colors. The ......
Read more >
How to change label color in the form?
You can use custom CSS codes to change the Font color of your labels. Here is a sample CSS code you can use....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found