Generate a KBar toolbar with NodeJS
Note: This only creates script buttons with SVG icons and a single script file
Manually creating a toolbar for every product update is tedious. Save time and avoid release anxiety by automating it.
/* | |
* Create a random RGB value. | |
* (c) 2009 Paul Irish, CCO License - http://creativecommons.org/publicdomain/zero/1.0/ | |
* https://www.paulirish.com/2009/random-hex-color-code-snippets/ | |
* @return {String} A random six-digit RGB hexcode | |
*/ | |
const getRandomRGB = function () { | |
return '#' + Math.floor(Math.random() * 16777215).toString(16) | |
} |
// Courtesy of @joonaspaakko | |
const picker = document.querySelector('input') | |
picker.oninput = function() { | |
const file = picker.files[0] | |
getBinary( file, function( binary ) { | |
const string = | |
`var dialog= new Window ("dialog"); | |
var image = "${binary}"; |