cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
269 stars 62 forks source link

overriding styles. #190

Closed joseberlines closed 3 years ago

joseberlines commented 3 years ago

Imagine I have three nodes: BER with classes Germany EU PAR with class EU MIL with class EU

if I have a style like: [{'selector': 'node', 'background-color': 'yellow'} {'selector': 'node[classes="EU"]', 'style': {'background-color': 'blue'}}, {'selector': 'node[classes="Germany"]', 'style': {'background-color': 'green']

Which should be the colour in case of conflict? are the styles apply strictly in order of appearance in the list? IN which case BER for being node is yellow, for being EU is blue, and for being Germany is green. So BER will rest Green.

ianhi commented 3 years ago

From https://js.cytoscape.org/#style

For simplicity and ease of use, specificity rules are completely ignored in stylesheets. For a given style property for a given element, the last matching selector wins.

and the style is ordered so I would expect the node to be green.

marimeireles commented 3 years ago

Can we close @joseberlines ?