Skip to content

Commit d8b9349

Browse files
committed
Better readability of graph visualisation in dark VSCode themes (issue #8)
1 parent 9c01cae commit d8b9349

File tree

2 files changed

+18
-73
lines changed

2 files changed

+18
-73
lines changed

src/inspector.css

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,3 @@
1-
2-
/* .links path {
3-
stroke: #444;
4-
stroke-opacity: 0.6;
5-
}
6-
7-
marker {
8-
stroke: #444;
9-
fill: #444;
10-
stroke-width: 0.1;
11-
}
12-
13-
.edgelabel textPath {
14-
fill: #444;
15-
}
16-
17-
.nodes circle {
18-
stroke: #fff;
19-
stroke-width: 1.5px;
20-
}
21-
22-
text {
23-
font-family: "Elsevier Display", sans-serif;
24-
font-size: 10px;
25-
}
26-
27-
.d3-tip {
28-
line-height: 1;
29-
padding: 6px;
30-
background: rgba(0, 0, 0, 0.8);
31-
color: #fff;
32-
border-radius: 4px;
33-
font-family: "Elsevier Display", sans-serif;
34-
35-
}
36-
37-
table {
38-
max-width: 500px;
39-
vertical-align: top;
40-
}
41-
42-
th, td {
43-
vertical-align: top;
44-
}
45-
46-
td {color: lightgray;}
47-
48-
svg {
49-
width: 100%;
50-
padding-bottom: 92%;
51-
height: 1px;
52-
overflow: visible
53-
} */
54-
55-
56-
57-
/* svg {
58-
border: 1px solid #ccc;
59-
} */
60-
61-
621
svg {
632
width: 100%;
643
padding-bottom: 92%;
@@ -69,6 +8,21 @@ svg {
698
body {
709
font: 10px sans-serif;
7110
}
11+
12+
body.vscode-light {
13+
color: black;
14+
fill: black;
15+
}
16+
17+
body.vscode-dark {
18+
color: white;
19+
fill: white;
20+
}
21+
22+
body.vscode-high-contrast {
23+
color: red;
24+
}
25+
7226
circle.node {
7327
fill: lightsteelblue;
7428
stroke: #555;
@@ -89,14 +43,3 @@ div.tooltip {
8943
position: absolute;
9044
display: block;
9145
}
92-
93-
/* table {
94-
max-width: 500px;
95-
vertical-align: top;
96-
}
97-
98-
th, td {
99-
vertical-align: top;
100-
}
101-
102-
td {color: lightgray;} */

src/inspector.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as d3 from "d3";
22
import { default as d3tip } from "d3-tip";
3-
// import { on } from "events";
3+
import { on } from "events";
4+
import css from './inspector.css';
45

56
document.addEventListener('DOMContentLoaded', function() {
67
const dataContents = window.document.getElementById('data').innerText;
@@ -128,6 +129,7 @@ function ForceGraph({nodes, links}, // a dictionary with nodes and links arrays.
128129
.style("opacity", 0)
129130
.attr("class","tooltip")
130131
.style("background-color", "white")
132+
.style("color","rgb(36, 41, 46)")
131133
.style("border", "solid")
132134
.style("border-width", "2px")
133135
.style("border-radius", "5px")

0 commit comments

Comments
 (0)