Make tab colors 'more' random

  1. dcma

    Member

    { #1 — 2 years ago }

    Sometimes the tabs colors are very close to each other (e.g. multiple shades of blue), as you might expect if the colors are chosen truly randomly. These occurrences make it slightly difficult to quickly determine which tab is open, especially when the tabs are adjoining.

    Could the tab color selection process be improved to ensure that there is a reasonable contrast in tab colors for better identification by dispersing the colors across the visible spectrum, sort of a random rainbow effect?

    Thanks. It's a great Firefox add-on.

  2. trlkly

    Member

    { #2 — 1 year ago }

    This is what I came to suggest. Implementation would involve storing the last few random tab colors in an array, and comparing all random colors against the array. The comparison would involve doing an OR check on each of the rgb values: something like

    if (Math.abs(r2 - r1) > 20 || Math.abs(g2 - g1) > 20 || Math.abs(b2 - b1) > 20) {<br />
         //get new random color
    } else {<br />
         //store color in array, probably using Array.unshift
    }
  3. Administrator

    Key Master

    { #3 — 1 year ago }

    Good point. And by design this will be useful for the random coloring option only.

Reply

You must log in to post.