react-force-graph icon indicating copy to clipboard operation
react-force-graph copied to clipboard

Set color of node labels

Open lvijnck opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. By default, the 3d graph is shown in dark. I'd like to draw my graph in a light theme. I managed to update the background, but could not a find a way to update the color of the node labels.

Describe the solution you'd like Attribute to color node labels or ability to establish a light theme in 3d

Describe alternatives you've considered n/a

lvijnck avatar Jan 31 '22 21:01 lvijnck

@lvijnck thanks for reaching out.

By labels, are you referring to the node tooltips (that appear on hover)? If so, those can be styled to your taste using regular CSS overrides. Just look for the .sceneTooltip css class.

vasturiano avatar Feb 01 '22 01:02 vasturiano

Hi @vasturiano, thanks for the prompt response!

I'm still not sure how to do this, I was searching the repo but could not find a snippet anywhere. Could you add some additional pointers?

P.S. Why does the library not support a theme param light for the dark mode?

lvijnck avatar Feb 01 '22 09:02 lvijnck

@lvijnck the tooltip styling is set on this repo: https://github.com/vasturiano/three-render-objects/blob/54366165fe0b3f077be13ac50aa5e077d67a5b97/src/three-render-objects.css#L10-L19

You can override any of those properties by setting the css on your own app, f.e.:

.scene-tooltip {
  color: black !important;
  font-size: 18px !important;
}

About the light theme, it's a good question. I find it more flexible to provide the means to customize the component and let the consuming apps establish the general look and feel. Imo, "canning" a component style typically leads to endless debate about what the defaults should be. Everyone's needs are different and that's ok, the components should be designed with that in mind.

vasturiano avatar Feb 01 '22 21:02 vasturiano