Open jlaw9 opened 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?
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.
The css field in GraphSpace which specifies the background color is in #cyGraphContainer
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.
@jlaw9 Can we close this issue now as per @JingVT's comment?
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.
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.
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.
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.