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:

// ColorNewTabs
// 
// This is a script for Directory Opus.
// See https://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.

// Called by Directory Opus to initialize the script
function OnInit(initData) {
    initData.name = "ColorNewTabs";
    initData.version = "1.0";
    initData.copyright = "";
    //	initData.url = "https://resource.dopus.com/viewforum.php?f=35";
    initData.desc = "";
    initData.default_enable = true;
    initData.min_version = "12.0";
}

// Called when a new tab is opened
function OnOpenTab(openTabData) {
    var cmd = DOpus.Create.Command;
    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);
}

Drag this into Preferences-Toolbars-Skripts:

ColorNewTabs.js.txt (833 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?