|
| 1 | +# Default Styling Configuration |
| 2 | + |
| 3 | +Graph Explorer supports an optional `defaultStyling.json` file that provides |
| 4 | +default vertex and edge styling for all users. This is useful for: |
| 5 | + |
| 6 | +- Non-persistent browser environments (e.g., AWS WorkSpaces Web) where IndexedDB |
| 7 | + is cleared between sessions |
| 8 | +- Pre-configuring a shared visual style for teams |
| 9 | +- Providing a consistent starting point for new users |
| 10 | + |
| 11 | +## How It Works |
| 12 | + |
| 13 | +On startup, Graph Explorer fetches `defaultStyling.json` and merges its values |
| 14 | +into the user's per-type styling preferences (stored in IndexedDB). Default |
| 15 | +values fill in any properties the user hasn't explicitly set — existing user |
| 16 | +overrides are preserved. |
| 17 | + |
| 18 | +When no `defaultStyling.json` is mounted, behavior is identical to the default |
| 19 | +Graph Explorer experience. When mounted, it populates the per-type styling that |
| 20 | +users can then customize. Resetting a vertex or edge style in the UI will revert |
| 21 | +to the `defaultStyling.json` values (or the hardcoded application defaults if no |
| 22 | +entry exists for that type). |
| 23 | + |
| 24 | +## Setup |
| 25 | + |
| 26 | +### Docker |
| 27 | + |
| 28 | +Mount the file into the container's configuration folder: |
| 29 | + |
| 30 | +```bash |
| 31 | +docker run \ |
| 32 | + -v /path/to/defaultStyling.json:/graph-explorer/packages/graph-explorer/defaultStyling.json \ |
| 33 | + public.ecr.aws/neptune/graph-explorer |
| 34 | +``` |
| 35 | + |
| 36 | +### Custom Icons |
| 37 | + |
| 38 | +To serve custom icon files (referenced by URL in the config), mount an icons |
| 39 | +directory: |
| 40 | + |
| 41 | +```bash |
| 42 | +docker run \ |
| 43 | + -v /path/to/defaultStyling.json:/graph-explorer/packages/graph-explorer/defaultStyling.json \ |
| 44 | + -v /path/to/icons:/graph-explorer/packages/graph-explorer/custom-icons \ |
| 45 | + public.ecr.aws/neptune/graph-explorer |
| 46 | +``` |
| 47 | + |
| 48 | +Icons in the `custom-icons` directory are served at `/custom-icons/<filename>`. |
| 49 | + |
| 50 | +## JSON Schema |
| 51 | + |
| 52 | +```json |
| 53 | +{ |
| 54 | + "vertices": { |
| 55 | + "<VertexTypeLabel>": { |
| 56 | + "color": "#hex", |
| 57 | + "icon": "lucide-icon-name", |
| 58 | + "iconUrl": "url-or-base64", |
| 59 | + "iconImageType": "image/svg+xml", |
| 60 | + "shape": "ellipse", |
| 61 | + "displayLabel": "Custom Label", |
| 62 | + "displayNameAttribute": "name", |
| 63 | + "longDisplayNameAttribute": "description", |
| 64 | + "backgroundOpacity": 0.4, |
| 65 | + "borderWidth": 0, |
| 66 | + "borderColor": "#hex", |
| 67 | + "borderStyle": "solid" |
| 68 | + } |
| 69 | + }, |
| 70 | + "edges": { |
| 71 | + "<EdgeTypeLabel>": { |
| 72 | + "displayLabel": "Custom Label", |
| 73 | + "displayNameAttribute": "name", |
| 74 | + "labelColor": "#hex", |
| 75 | + "labelBackgroundOpacity": 0.7, |
| 76 | + "labelBorderColor": "#hex", |
| 77 | + "labelBorderStyle": "solid", |
| 78 | + "labelBorderWidth": 0, |
| 79 | + "lineColor": "#hex", |
| 80 | + "lineThickness": 2, |
| 81 | + "lineStyle": "solid", |
| 82 | + "sourceArrowStyle": "none", |
| 83 | + "targetArrowStyle": "triangle" |
| 84 | + } |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +All properties are optional — only specify what you want to override. Type |
| 90 | +labels must exactly match the vertex/edge type names in your graph database. |
| 91 | + |
| 92 | +### Icons |
| 93 | + |
| 94 | +There are two ways to specify vertex icons: |
| 95 | + |
| 96 | +- **`icon`** — A [Lucide](https://lucide.dev/icons) icon name in kebab-case |
| 97 | + (e.g., `"user"`, `"log-in"`, `"landmark"`). Resolved to an SVG at runtime. No |
| 98 | + additional files needed. |
| 99 | +- **`iconUrl`** — A URL or base64 data URI for a custom icon. Use this for |
| 100 | + non-Lucide icons. If both `icon` and `iconUrl` are specified, `iconUrl` takes |
| 101 | + precedence. |
| 102 | + |
| 103 | +### Vertex Shapes |
| 104 | + |
| 105 | +Available shapes: `ellipse`, `rectangle`, `diamond`, `triangle`, `pentagon`, |
| 106 | +`hexagon`, `heptagon`, `octagon`, `star`, `barrel`, `vee`, `rhomboid`, `tag`, |
| 107 | +`round-rectangle`, `round-triangle`, `round-diamond`, `round-pentagon`, |
| 108 | +`round-hexagon`, `round-heptagon`, `round-octagon`, `round-tag`, |
| 109 | +`cut-rectangle`, `concave-hexagon`. |
| 110 | + |
| 111 | +### Line Styles |
| 112 | + |
| 113 | +Available for edges and borders: `solid`, `dashed`, `dotted`. |
| 114 | + |
| 115 | +### Arrow Styles |
| 116 | + |
| 117 | +Available for `sourceArrowStyle` and `targetArrowStyle`: `triangle`, |
| 118 | +`triangle-tee`, `circle-triangle`, `triangle-cross`, `triangle-backcurve`, |
| 119 | +`tee`, `vee`, `square`, `circle`, `diamond`, `none`. |
| 120 | + |
| 121 | +## Common Lucide Icons for Graph Use Cases |
| 122 | + |
| 123 | +| Use Case | Icon Name | |
| 124 | +| -------------------- | --------------------------------- | |
| 125 | +| Person / User | `user` | |
| 126 | +| Account / Bank | `landmark` | |
| 127 | +| Email | `mail` | |
| 128 | +| Phone | `phone` | |
| 129 | +| Login / Auth | `log-in` | |
| 130 | +| Device | `monitor`, `laptop`, `smartphone` | |
| 131 | +| IP Address / Network | `globe`, `network` | |
| 132 | +| Transaction | `arrow-left-right` | |
| 133 | +| Location | `map-pin` | |
| 134 | +| Organization | `building` | |
| 135 | +| Alert | `shield-alert`, `triangle-alert` | |
| 136 | +| Document | `file-text` | |
| 137 | +| Calendar / Date | `calendar` | |
| 138 | +| Lock / Security | `lock`, `shield` | |
| 139 | +| Database | `database` | |
| 140 | +| Server | `server` | |
| 141 | +| Link / Relationship | `link` | |
| 142 | + |
| 143 | +See the full list at [lucide.dev/icons](https://lucide.dev/icons). |
| 144 | + |
| 145 | +## Import / Export / Reset |
| 146 | + |
| 147 | +The Settings page provides styling management: |
| 148 | + |
| 149 | +- **Export Styling** — exports the current per-type styling as a |
| 150 | + `defaultStyling.json` file, for sharing or Docker-mounting as team defaults. |
| 151 | +- **Import Styling** — imports a `defaultStyling.json` file. This is an |
| 152 | + alternative to mounting the file in Docker. |
| 153 | +- **Reset All Styling** — resets all styling to defaults. If a |
| 154 | + `defaultStyling.json` is mounted, those values are restored; otherwise, |
| 155 | + styling reverts to the application defaults. |
| 156 | + |
| 157 | +Per-type reset is also available in the Node/Edge Style dialogs via the "Reset |
| 158 | +to Default" button. |
| 159 | + |
| 160 | +## Example |
| 161 | + |
| 162 | +See [`example/defaultStyling.json`](../example/defaultStyling.json) for a |
| 163 | +complete example with banking-oriented vertex and edge types. |
0 commit comments