/*
 * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
 *  
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 *  
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *  
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 *
 */

/* General Utilities */

.shadow() {
    -webkit-filter: shadow(0 1px 0 @mid-bg-alt)
}

.color-transparency(@color, @alpha: 1) {
    color: rgba( red(@color), green(@color), blue(@color), @alpha);
}

.background-transparency(@color, @alpha: 1) {
    background: rgba( red(@color), green(@color), blue(@color), @alpha);
}

.border-transparency(@size, @lineType, @color, @alpha: 1) {
    border: @size @lineType rgba( red(@color), green(@color), blue(@color), @alpha);
}

.background-checkerboard(@size: 10) {
    @halfsize: @size / 2;
    background-color: @color-preview-background;
    // checkerboard
    background-image:
    -webkit-linear-gradient(45deg, @color-checkerboard 25%, transparent 25%,transparent 75%, @color-checkerboard 75%, @color-checkerboard 100%),
    -webkit-linear-gradient(45deg, @color-checkerboard 25%, transparent 25%,transparent 75%, @color-checkerboard 75%, @color-checkerboard 100%);
    background-size: ~"@{size}px" ~"@{size}px";
    background-position: 0 0, ~"@{halfsize}px" ~"@{halfsize}px";
}

.random-color(){
  @random-color: `Math.floor(Math.random()*16777215).toString(16)`;
  @color-hex: e(@random-color);
  @color: ~"#@{color-hex}";
}
