Set folder tabs to random non repeated colors by default

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