Set folder tabs to random non repeated colors by default

Hi,
Is it possible to set tabs to be colored by default?
Also is it possible to set colors to be random and non-repeated?
Thanks

A script add-in could do it.

1 Like

If I do not know how to do it, any hope that someone can do it or a way to guide how to do it?
Thanks

A quick lunch break hack:

function OnInit(initData) {
    initData.name = 'ColorNewTabs';
    initData.version = '2022-03-05';
    initData.url = 'https://resource.dopus.com/t/set-folder-tabs-to-random-non-repeated-colors-by-default/32300';
    initData.desc = 'Applies a randomly picked color to new tabs';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnOpenTab(openTabData) {
    var cmd = DOpus.Create().Command();
    cmd.SetSourceTab(openTabData.tab);
    var R = (Math.random() * 255).toFixed(0);
    var G = (Math.random() * 255).toFixed(0);
    var B = (Math.random() * 255).toFixed(0);
    cmd.RunCommand('Go TABCOLOR=' + R + ',' + G + ',' + B);
}

EventColorNewTabs.js.txt (687 Bytes)

3 Likes

Thanks a lot my friend :slight_smile:
Excellent :slight_smile:

I've v.11 on an old computer belongs to work.
I asked if they may upgrade to v.12 so I can use the script but they said no as they find v.11 is more then enough for what they need at work.
How to let this script work for v.11 ?
Thanks

If the obvious thing of changing the initData.min_version = "12.0"; line doesn't work then the script probably uses something that wasn't possible in Opus 11.

1 Like

I did tried to edit it to 11 but did not worked.
I hope if @lxp may help.

I'll have a look, but I only have a phone available at the moment, so it'll be a moment.

1 Like

Take your time.
Thanks for your help.

Sorry, colored tabs (via Go TABCOLOR) were not available in Opus v11.

But v12 has so many cool features, shouldn't it be easy to find a reason for an upgrade?

I am afraid that it is not my decision my friend.

The script doesn't seem to work for tabs opened by selecting folders and dragging them to the tab bar.

I have updated the script.

3 Likes

Thanks