// ==UserScript== // @name Colorful Tabs // @namespace http://www.xuldev.org/ // @description Makes the tabs colorful. // @include main // @compatibility Firefox 3.0, 3.5, 3.6b4 // @author Gomita // @version 1.1.20091203 // @homepage http://www.xuldev.org/misc/ucjs.php // ==/UserScript== // @version 1.1.20091203 Now compatible with Firefox 3.0 - 3.6b4 var ucjsColorfulTabs = { index: 0, palette: [ "#FFCCCC", "#FFCC99", "#FFFF99", "#99FF99", "#99FFFF", "#CCCCFF", "#FFCCFF", "#FFFFCC", "#FF9966", "#FFFF66", "#33FFFF", "#9999FF", "#FF99FF", "#FFCC66", "#66CCCC", ], colorTab: function(aTab) { // this part is originated from Jetpack Colorful Tab feature. // @see http://d.hatena.ne.jp/Griever/20090523/1243069782 aTab.style.backgroundColor = this.palette[++this.index % this.palette.length]; }, init: function() { // if you don't want to start with a random color, comment out the following line. this.index = Math.floor(Math.random(this.palette.length)); // color all tabs when opening a window Array.forEach(gBrowser.mTabs, this.colorTab, this); // color the last tab when adding a new tab var self = this; gBrowser.addEventListener("TabOpen", function(event) { self.colorTab(event.originalTarget); }, false); } }; ucjsColorfulTabs.init();