Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stylish that colors the entire Trello card based on labels
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("trello.com") {
/* Highlight cards
* These must go in the same order
* as the hiding labels
* Note, there ordering is important, the colors at the bottom will take precedence over those at the top
*/
div.list-card.purple-label {
background: plum !important;
}
div.list-card.green-label {
background: paleGreen !important;
}
div.list-card.yellow-label {
background: LightGoldenrodYellow !important;
}
div.list-card.orange-label {
background: orange !important;
}
div.list-card.blue-label {
background: lightBlue !important;
}
div.list-card.red-label {
background: indianRed !important;
}
/* Hide label of highlighted color
* This was generated with the following ruby code:
colors = %w[purple green yellow orange blue red]
colors.each do |card|
colors.each do |label|
if (card == label)
puts <<EOS
div.list-card.#{card}-label .card-label.#{label}-label {
display: none !important;
}
EOS
else
puts <<EOS
div.list-card.#{card}-label .card-label.#{label}-label {
display: block !important;
}
EOS
end
end
end
*/
div.list-card.purple-label .card-label.purple-label {
display: none !important;
}
div.list-card.purple-label .card-label.green-label {
display: block !important;
}
div.list-card.purple-label .card-label.yellow-label {
display: block !important;
}
div.list-card.purple-label .card-label.orange-label {
display: block !important;
}
div.list-card.purple-label .card-label.blue-label {
display: block !important;
}
div.list-card.purple-label .card-label.red-label {
display: block !important;
}
div.list-card.green-label .card-label.purple-label {
display: block !important;
}
div.list-card.green-label .card-label.green-label {
display: none !important;
}
div.list-card.green-label .card-label.yellow-label {
display: block !important;
}
div.list-card.green-label .card-label.orange-label {
display: block !important;
}
div.list-card.green-label .card-label.blue-label {
display: block !important;
}
div.list-card.green-label .card-label.red-label {
display: block !important;
}
div.list-card.yellow-label .card-label.purple-label {
display: block !important;
}
div.list-card.yellow-label .card-label.green-label {
display: block !important;
}
div.list-card.yellow-label .card-label.yellow-label {
display: none !important;
}
div.list-card.yellow-label .card-label.orange-label {
display: block !important;
}
div.list-card.yellow-label .card-label.blue-label {
display: block !important;
}
div.list-card.yellow-label .card-label.red-label {
display: block !important;
}
div.list-card.orange-label .card-label.purple-label {
display: block !important;
}
div.list-card.orange-label .card-label.green-label {
display: block !important;
}
div.list-card.orange-label .card-label.yellow-label {
display: block !important;
}
div.list-card.orange-label .card-label.orange-label {
display: none !important;
}
div.list-card.orange-label .card-label.blue-label {
display: block !important;
}
div.list-card.orange-label .card-label.red-label {
display: block !important;
}
div.list-card.blue-label .card-label.purple-label {
display: block !important;
}
div.list-card.blue-label .card-label.green-label {
display: block !important;
}
div.list-card.blue-label .card-label.yellow-label {
display: block !important;
}
div.list-card.blue-label .card-label.orange-label {
display: block !important;
}
div.list-card.blue-label .card-label.blue-label {
display: none !important;
}
div.list-card.blue-label .card-label.red-label {
display: block !important;
}
div.list-card.red-label .card-label.purple-label {
display: block !important;
}
div.list-card.red-label .card-label.green-label {
display: block !important;
}
div.list-card.red-label .card-label.yellow-label {
display: block !important;
}
div.list-card.red-label .card-label.orange-label {
display: block !important;
}
div.list-card.red-label .card-label.blue-label {
display: block !important;
}
div.list-card.red-label .card-label.red-label {
display: none !important;
}
}
@float-mode

This comment has been minimized.

Copy link

commented Mar 30, 2014

It seems like this no longer works with the most recent trello site...

@chmac

This comment has been minimized.

Copy link

commented May 23, 2014

Yeah, trello.com today generates a <div class="list-card js-member-droppable ui-droppable"> whether the card has a label or not.

Looks like this without a label:

<div class="list-card js-member-droppable ui-droppable">
    <div class="list-card-labels clearfix js-card-labels"></div>
    ...
</div>

Or this with:

<div class="list-card js-member-droppable ui-droppable">
    <div class="list-card-labels clearfix js-card-labels">
        <span class="card-label card-label-green" title="green label (default)">  &nbsp; </span>
    </div>
    ...
</div>

Probably possible to do something with Greasemonkey based on this, jQuery is available...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.