Skip to content

Commit

Permalink
Color of Types? (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
NybyDK committed Feb 23, 2024
2 parents 0ec059f + 29371ff commit 1e5f45d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/Mermaid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
import { onMount } from "svelte";
import { Render } from "svelte-purify/browser-only";
import { network } from "$lib/stores/network";
import { NodeType } from "$lib/interfaces/network";
const nodeColors = {
[NodeType.Customer]: "lightgreen",
[NodeType.Edge]: "cyan",
[NodeType.Core]: "hotpink",
};
let input: string;
$: {
input = `flowchart LR\n`;
input += $network.nodes.map((n) => ` ${n.id}[(${n.label})]`).join("\n");
input = `flowchart LR;\n`;
input += $network.nodes.map((n) => ` style ${n.id} fill:${nodeColors[n.type]};`).join("\n");
input += "\n";
input += $network.nodes.map((n) => ` ${n.id}[(${n.label})];`).join("\n");
input += "\n";
input += $network.connections.map((c) => ` ${c.source} --- ${c.target}`).join("\n");
input += $network.connections.map((c) => ` ${c.source} --- ${c.target};`).join("\n");
}
onMount(() => {
Expand Down

0 comments on commit 1e5f45d

Please sign in to comment.