Skip to content

Instantly share code, notes, and snippets.

@sheymann
Forked from dividedmind/linkurious.js
Last active December 28, 2015 10:39
Show Gist options
  • Save sheymann/7488035 to your computer and use it in GitHub Desktop.
Save sheymann/7488035 to your computer and use it in GitHub Desktop.
sigi = sigma.instances[1];
var prefix = /.{7}/;
sigi.iterNodes(function (node) {
node.label = node.attr.kind + ": " + node.attr.name.replace(prefix, '');
});
WebFontConfig = {
google: { families: [ 'Lato::latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
var drawingProperties = {
edgeLabelThreshold: 1,
edgeLabelSizeRatio: 1,
defaultEdgeColor: "#a9a9a9",
defaultEdgeLabelColor: "#333333",
font: 'Lato',
edgeFont: 'Lato'
};
var kind_colors = {
environment: "#000000",
group: "#666666",
variable: "#1d1d1d",
resource: "#018798",
user: "#4a5960",
host: "#9D0D0D",
service: "#009380"
};
function kind_color(kind) {
return kind_colors[kind];
}
sigi.iterEdges(function (e) { e.color = undefined } );
sigi.iterNodes(function (n) { n.color = kind_color(n.attr.kind) } );
sigi.drawingProperties(drawingProperties);
console.log(drawingProperties);
console.log(kind_colors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment