-
-
Save ovace/d970d6eac3e6a228c4371883455e9a29 to your computer and use it in GitHub Desktop.
#jArchi Color the selected elements with web safe colors
This file contains hidden or 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
// Author: Rob Kamp | |
// Requires: jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/ | |
// Purpose: Color the selected elements with web safe colors | |
// Date: 2019-11-20 | |
// Version 1.1 | |
// Change: changed the title to add the #jArchi tag | |
console.log("Start: Color the selected elemets"); | |
// Web safe colors | |
colors = ['#e6194b', '#3cb44b', '#ffe119', '#4363d8', '#f58231', '#911eb4', '#46f0f0', '#f032e6', '#bcf60c', '#fabebe', '#008080', '#e6beff', '#9a6324', '#fffac8', '#800000', '#aaffc3', '#808000', '#ffd8b1', '#000075', '#808080']; | |
// Sort the selected concepts on the diagram | |
$(selection).sort(function (left,right) { | |
return left.bounds.x-right.bounds.x; | |
}); | |
// Vairable to track the color to be selected | |
color = 0; | |
// Walk through the sorted and selected elements | |
$(selection).each(function (element) { | |
// Select the fill color | |
element.fillColor = colors[color++ % colors.length]; | |
}); | |
console.log("End: Color the selected elemets"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment