Skip to content

Instantly share code, notes, and snippets.

@examinedliving
Last active May 11, 2017 17:18
Show Gist options
  • Save examinedliving/5079f9dbbc933d57dfba25485875307b to your computer and use it in GitHub Desktop.
Save examinedliving/5079f9dbbc933d57dfba25485875307b to your computer and use it in GitHub Desktop.
Mixin to generate CSS to change the label colors in Trello. Meant to be used with Stylish or another runtime css modifier.
// Trello mixin to use with stylish or something.
// Changes the trello card label colors based upon color variables
// wrapped it all in one mixin just for fun - the outer mixin is only useful for cleanliness and organization
.make-card-labels(){
// list of all label colors in Trello. Variable name must remain as they are for this mixin to work properly.
@red:#CF4647;
@orange:#EB7B59;
@yellow:#CACF43;
@lime:#94CA3D;
@green:#44AA55;
@blue:#2B4E72;
@sky:#62BECB;
@purple:#9061C2;
@pink:#ED146F;
@black:#556270;
@text-color:#fafafa;
@text-shadow:0 -1px 1px rgba(0,0,0,.1), 0 1px 1px rgba(255,255,255,.1);
.card-label(@bg,@tc:~"#ffffff",@ts:~"0px 0px 0px transparent"){
// selector to handle the background
@selector:~"card-label-@{bg}";
// selector for handling the box-shadow of selected labels
@selected-selector:~"@{selector}.mod-selectable.selected";
// selector for handling the text-color
@text-selector:~"card-label.@{selector}";
// converts selector text into value of color variable
@bg-color:@@bg;
// box-shadow color for when hovering over labels at label selection
@bs-color:darken(@bg-color,40%);
.@{text-selector}{
// default text color and text-shadow - overwritable
color:@tc;
text-shadow:@ts;
}
.@{selector}{
background:@bg-color;
background-color:@bg-color;
}
.@{selected-selector}{
box-shadow:-8px 0 @bs-color;
}
}
// first-argument, variable text of desired color
// see not above - these variable names can't change
// second-argument - text-color
// third-argument - text-shadow for text
// second and third arguments are optional - defaults to white color and 0px transparent text-shadow
.card-label(black,@text-color,@text-shadow);
.card-label(blue,@text-color,@text-shadow);
.card-label(green,@text-color,@text-shadow);
.card-label(lime,@text-color,@text-shadow);
.card-label(orange,@text-color,@text-shadow);
.card-label(pink,@text-color,@text-shadow);
.card-label(purple,@text-color,@text-shadow);
.card-label(red,@text-color,@text-shadow);
.card-label(sky,@text-color,@text-shadow);
.card-label(yellow,@text-color,@text-shadow);
}
// execute main mixin function
.make-card-labels();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment