Setting color slots, please?

To quote other posts that never got answered:

Can this please be added soon? (and rings, probably also, but that might be harder)

Should also be easier to implement. Look at threads.js:

Process.prototype.doSetSlot = function(name, value) {
    var sym = Symbol.for('block'),
        frame, block, slot, subslots;
    if (!name) {return; }
    frame = this.context.variables.silentFind(sym);
    if (!frame) {return; }
    block = frame.getVar(sym);
    if (block.isCustomBlock) {
        slot = block.inputSlotNamed(name);
        if (slot instanceof InputSlotMorph) {
            slot.setContents(value.toString());
        } else if (slot instanceof BooleanSlotMorph) {
            slot.setContents(value);
        } else if (slot instanceof MultiArgMorph) {
            if (!(value instanceof List)) {
                value = new List([value]);
            }
            slot.expandTo(value.length());
            subslots = slot.inputs();
            value.itemsArray().forEach((item, i) => {
                if (subslots[i] instanceof InputSlotMorph) {
                    subslots[i].setContents(
                        isNil(item) ? '' : item.toString()
                    );
                } else if (subslots[i] instanceof BooleanSlotMorph) {
                    subslots[i].setContents(item);
                }
            });
        }
    }
};

All you really need to do for colors is to duplicate the BooleanSlotMorph (as you would be calling this function with a color, anyway) and make it a ColorSlotMorph, and of course updating the name menu to notice this.

you can use a variadic input in the meantime, it works well.

does this help?

untitled script pic (8)

they meant unblocking set slot [ V] to [] and when slot [ V] signals [ V]

But this doesn’t work

Wait… then I can use that for one blocks! Still, a color input should be allowed!

For colors specifically, you can’t use normal set slot for variadic color slots since it will only set the slot to the untitled script pic (32) color; use this modified block: untitled script pic (31)