Murali-group / GraphSpace

The interactive graph sharing website.
http://graphspace.org
GNU General Public License v2.0
30 stars 41 forks source link

Set dark background color #291

Open jlaw9 opened 7 years ago

jlaw9 commented 7 years ago

This is currently a problem because nodes with a white background are not visible (see this example)

Looks like the cytoscape style JSON only sets the styles of nodes and edges. The tokyo-railways example sets the background color on line 15 of style.css.

Can we add the ability to change the background color either in the UI, through the Rest API, or both? I think the simplest option would be to add a "canvas-background-color" field recognized by GraphSpace to the style JSON file being uploaded/downloaded.

mitchwagner commented 7 years ago

I agree, I think it would be better from a user perspective to have the option to set it permanently. But, do we want to modify/add non-standard options to the cytoscape style JSON format we use?

Are we already doing that, or would this make us incompatible? Would adding such an option complicate export from GraphSpace?

jlaw9 commented 6 years ago

It shouldn't be an issue to add additional properties to the top-level of the cytoscape-style JSON. GraphSpace already adds a couple. Other applications that don't use that field/option would just ignore it.

jlaw9 commented 6 years ago

The css field in GraphSpace which specifies the background color is in #cyGraphContainer

JingVT commented 6 years ago

The CytoscapeJS and Cytoscape projects have diverged quite a bit over the years caused this issue. We will wait for them to align the visual styles. The current better solution is suggesting GraphSpace users don't set background color of nodes to white.

tmmurali commented 6 years ago

@jlaw9 Can we close this issue now as per @JingVT's comment?

jlaw9 commented 6 years ago

The cytoscape team said they are not planning to add background-color to the style JSON, so I don't think we should wait for them.

I still think we should be able to update GraphSpace to recognize when a special field is present at the top level of the style JSON such as "background-color" and then take the value from there and set the corresponding CSS tag to that color value.

Once we have that working in GraphSpace, we can update CyGraphSpace to grab the background color from Cytoscape and set the "background-color" field in the style JSON before uploading to GraphSpace. That way any graph uploaded from CyGraphSpace will retain the background color in GraphSpace.

We could also/alternatively add an option to the layout/style editor to be able to set the background color in the UI.

tmmurali commented 6 years ago

The main concern about your approach is that it introduces yet another GraphSpace-specific style element to the JSON. I would very much like to avoid doing this.

jlaw9 commented 6 years ago

I'm not aware of any other GraphSpace-specific style elements. We do add a couple fields such as "generated_by": "graphspace-2.0.0" at the top. I don't think adding an extra "background-color" field would be a problem as any other program that loads cytoscape JS style files would just ignore it.

I also think storing it in the style/layout JSON would be more transparent for the user than setting some internal variable, and would probably also be easier to implement as we already store/load the JSON files.