Created
August 3, 2016 02:39
-
-
Save robfe/45d6c6468da6922f50804e09d39030f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mm = components.mapModel; | |
var colours = '#FDB813 #A7BE38 #9EA4C1 #FF8384 #FFD87D'.split(' '); | |
function walk(node, depth){ | |
if(!depth || !mm.getStyleForId(node.id, 'background')){ | |
console.log('setting '+node.title +' to ' +colours[depth], depth); | |
mm.selectNode(node.id); | |
mm.updateStyle('script', 'background', colours[depth]); | |
} | |
if(!node.ideas || colours.length == depth+1){ | |
return; | |
} | |
for(var k of Object.getOwnPropertyNames(node.ideas)){ | |
walk(node.ideas[k], depth+1); | |
} | |
} | |
walk(mm.getIdea(), 0); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment