Use dark color scheme for schema graph in browser preview
This commit is contained in:
@@ -201,30 +201,30 @@ function markForeignKeyColumns(tables, edges) {
|
||||
}
|
||||
|
||||
const EDGE_COLORS = [
|
||||
'#c53030',
|
||||
'#2f855a',
|
||||
'#2b6cb0',
|
||||
'#b7791f',
|
||||
'#6b46c1',
|
||||
'#c05621',
|
||||
'#319795',
|
||||
'#97266d',
|
||||
'#4c51bf',
|
||||
'#276749',
|
||||
'#9c4221',
|
||||
'#0987a0',
|
||||
'#553c9a',
|
||||
'#742a2a',
|
||||
'#22543d',
|
||||
'#1a365d',
|
||||
'#702459',
|
||||
'#744210',
|
||||
'#285e61',
|
||||
'#d53f8c',
|
||||
'#dd6b20',
|
||||
'#38a169',
|
||||
'#3182ce',
|
||||
'#805ad5',
|
||||
'#ff6b6b',
|
||||
'#6bdf9a',
|
||||
'#5aa7ff',
|
||||
'#f5c15c',
|
||||
'#c79bff',
|
||||
'#ff9f5a',
|
||||
'#5cd6d6',
|
||||
'#ff7fc2',
|
||||
'#8f95ff',
|
||||
'#58d18a',
|
||||
'#ff8f66',
|
||||
'#4fc4e8',
|
||||
'#a98cff',
|
||||
'#ff6f6f',
|
||||
'#4ecb8f',
|
||||
'#5aa7e6',
|
||||
'#ff7aa8',
|
||||
'#e0b25a',
|
||||
'#56c8c8',
|
||||
'#ff5f9e',
|
||||
'#ffb25a',
|
||||
'#56d68a',
|
||||
'#66b3ff',
|
||||
'#c79bff',
|
||||
];
|
||||
|
||||
function edgeKey(edge) {
|
||||
@@ -371,15 +371,16 @@ const CLUSTERS = [
|
||||
];
|
||||
|
||||
const COLORS = {
|
||||
background: '#ebf4ff',
|
||||
tableBorder: '#a0aec0',
|
||||
headerBg: '#bee3f8',
|
||||
headerText: '#1a365d',
|
||||
rowBg: '#ffffff',
|
||||
rowBgAlt: '#f7fafc',
|
||||
keyBg: '#ebf8ff',
|
||||
text: '#2d3748',
|
||||
muted: '#718096',
|
||||
background: '#1e2430',
|
||||
tableBorder: '#3f4c5f',
|
||||
headerBg: '#33415c',
|
||||
headerText: '#e2e8f0',
|
||||
rowBg: '#2a3242',
|
||||
rowBgAlt: '#272e3d',
|
||||
keyBg: '#2b3a52',
|
||||
text: '#d8dee9',
|
||||
muted: '#8b95a7',
|
||||
clusterFill: '#202a3a',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -825,7 +826,7 @@ function buildDot(tables, edges, positions = null, anchors = null) {
|
||||
lines.push(` subgraph cluster_${cluster.id} {`);
|
||||
lines.push(
|
||||
` label="${escapeHtml(cluster.label)}"; labeljust="l"; fontsize=15;`,
|
||||
` style="rounded,filled"; fillcolor="#ffffff60"; color="${COLORS.tableBorder}";`,
|
||||
` style="rounded,filled"; fillcolor="${COLORS.clusterFill}"; color="${COLORS.tableBorder}";`,
|
||||
` fontcolor="${COLORS.headerText}"; margin=14;`
|
||||
);
|
||||
|
||||
@@ -1040,8 +1041,15 @@ const optimized = optimizeAnchorsWithLayout(
|
||||
baseAnchors
|
||||
);
|
||||
|
||||
// Fill the whole canvas (including Graphviz's pad margin) so there is no
|
||||
// transparent/white gutter around the dark graph when opened in a browser.
|
||||
const finalsvg = optimized.svg.replace(
|
||||
/<svg([^>]*?)>/,
|
||||
`<svg$1 style="background-color:${COLORS.background};">`
|
||||
);
|
||||
|
||||
writeFileSync(dotOutputPath, optimized.dot, 'utf8');
|
||||
writeFileSync(outputPath, optimized.svg, 'utf8');
|
||||
writeFileSync(outputPath, finalsvg, 'utf8');
|
||||
|
||||
const dim = optimized.svg.match(/width="([\d.]+)pt" height="([\d.]+)pt"/);
|
||||
|
||||
|
||||
222
schema-graph.dot
222
schema-graph.dot
File diff suppressed because one or more lines are too long
2466
schema-graph.svg
2466
schema-graph.svg
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 187 KiB |
Reference in New Issue
Block a user