Skip to content

Commit 32bf476

Browse files
committed
feat: use more standardised colour coding
1 parent 8e13f26 commit 32bf476

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ A YASGUI plugin for visualizing SPARQL CONSTRUCT and DESCRIBE query results as i
1010
- **🔷 Interactive Graph Visualization**: Automatic force-directed layout with smooth physics-based positioning
1111
- **🎨 Smart Color Coding**:
1212
- 🔵 Light Blue (#97C2FC) = URIs
13-
- 🟢 Light Green (#a6c8a6ff) = rdf:type objects (classes)
14-
- ⚪ Light Grey (#c5c5c5ff) = Literals
15-
- 🟠 Orange (#e15b13ff) = Blank nodes
13+
- 🟢 Light Green (#a6c8a6ff) = Literals
14+
- ⚪ Light Grey (#c5c5c5ff) = Blank nodes
15+
- 🟠 Orange (#e15b13ff) = rdf:type objects (classes)
1616
- **🔍 Navigation**: Mouse wheel zoom, drag to pan, "Zoom to Fit" button
1717
- **✋ Drag & Drop**: Reorganize nodes by dragging them to new positions
1818
- **💬 Tooltips**: Hover for full URI/literal details (300ms delay)
@@ -107,11 +107,11 @@ After running the query, click the **"Graph"** tab to see the visualization.
107107
### Understanding Colors
108108

109109
| Color | Meaning | Example |
110-
|-------|---------|---------|
110+
|-------|---------|---------||
111111
| 🔵 Light Blue (#97C2FC) | URI nodes | `ex:Person`, `ex:Alice` |
112-
| 🟢 Light Green (#a6c8a6ff) | rdf:type objects (classes) | `ex:Person` in `ex:Alice rdf:type ex:Person` |
113-
| ⚪ Light Grey (#c5c5c5ff) | Literal values | `"Alice"`, `"30"^^xsd:integer` |
114-
| 🟠 Orange (#e15b13ff) | Blank nodes | `_:b1`, `_:addr1` |
112+
| 🟢 Light Green (#a6c8a6ff) | Literal values | `"Alice"`, `"30"^^xsd:integer` |
113+
| ⚪ Light Grey (#c5c5c5ff) | Blank nodes | `_:b1`, `_:addr1` |
114+
| 🟠 Orange (#e15b13ff) | rdf:type objects (classes) | `ex:Person` in `ex:Alice rdf:type ex:Person` |
115115

116116
## ⚙️ Configuration
117117

specs/001-construct-graph-viz/data-model.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Represents a unique subject or object from RDF triples in the visualization.
1414
- `id` (Number): Unique numeric identifier for vis-network (auto-incremented)
1515
- `uri` (String | null): Full URI for URI nodes, null for literals
1616
- `label` (String): Display text (prefixed URI or literal value, truncated if needed)
17-
- `color` (String): Hex color code - `#c5c5c5ff` (light grey, literals), `#a6c8a6ff` (light green, rdf:type objects), `#97C2FC` (light blue, other URIs), `#e15b13ff` (orange, blank nodes)
17+
- `color` (String): Hex color code - `#a6c8a6ff` (light green, literals), `#e15b13ff` (orange, rdf:type objects), `#97C2FC` (light blue, other URIs), `#c5c5c5ff` (light grey, blank nodes)
1818
- `type` (Enum): `'uri'` or `'literal'`
1919
- `fullValue` (String): Un-truncated value for tooltip display
2020

@@ -33,7 +33,7 @@ Represents a unique subject or object from RDF triples in the visualization.
3333
id: 1,
3434
uri: 'http://example.org/Person',
3535
label: 'ex:Person',
36-
color: '#a6c8a6ff', // Light green if object of rdf:type
36+
color: '#e15b13ff', // Orange if object of rdf:type
3737
type: 'uri',
3838
fullValue: 'http://example.org/Person'
3939
}
@@ -42,7 +42,7 @@ Represents a unique subject or object from RDF triples in the visualization.
4242
id: 2,
4343
uri: null,
4444
label: 'John',
45-
color: '#c5c5c5ff', // Light grey for literals
45+
color: '#a6c8a6ff', // Light green for literals
4646
type: 'literal',
4747
fullValue: '"John"^^xsd:string'
4848
}

src/colorUtils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
* @returns {string} Hex color code
66
*/
77
function getNodeColor(node, triples) {
8-
// Blank nodes: yellow
8+
// Blank nodes: light grey
99
if (node.uri && node.uri.startsWith('_:')) {
10-
return '#e15b13ff';
10+
return '#c5c5c5ff';
1111
}
1212

13-
// Literals: grey
13+
// Literals: light green
1414
if (node.type === 'literal') {
15-
return '#c5c5c5ff';
15+
return '#a6c8a6ff';
1616
}
1717

18-
// Check if node is object of rdf:type predicate: green
18+
// Check if node is object of rdf:type predicate: orange
1919
const isTypeObject = triples.some(
2020
(triple) =>
2121
triple.predicate === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' &&
2222
triple.object.value === node.uri
2323
);
2424

2525
if (isTypeObject) {
26-
return '#a6c8a6ff';
26+
return '#e15b13ff';
2727
}
2828

29-
// Other URIs: blue
29+
// Other URIs: light blue
3030
return '#97C2FC';
3131
}
3232

0 commit comments

Comments
 (0)