.triangle-base() {
    content: '';
    display: block;
    width: 0;
    height: 0;
    -moz-transform: scale(.9999);
}

.triangle(@direction, @color, @size) {
    .triangle(@direction, @size * 2, @size, @color);
}

.triangle(@direction, @color: @color-white, @width: @base-triangle-width, @height: @base-triangle-height) when (@direction = up) {
    .triangle-base();
    border-left: (@width / 2) solid transparent;
    border-right: (@width / 2) solid transparent;
    border-bottom: @height solid @color;
}

.triangle(@direction, @color: @color-white, @width: @base-triangle-width, @height: @base-triangle-height) when (@direction = down) {
    .triangle-base();
    border-left: (@width / 2) solid transparent;
    border-right: (@width / 2) solid transparent;
    border-top: @height solid @color;
}

.triangle(@direction, @color: @color-white, @width: @base-triangle-width, @height: @base-triangle-height) when (@direction = left) {
    .triangle-base();
    border-top: (@width / 2) solid transparent;
    border-bottom: (@width / 2) solid transparent;
    border-right: @height solid @color;
}

.triangle(@direction, @color: @color-white, @width: @base-triangle-width, @height: @base-triangle-height) when (@direction = right) {
    .triangle-base();
    border-top: (@width / 2) solid transparent;
    border-bottom: (@width / 2) solid transparent;
    border-left: @height solid @color;
}
