mixins.less 6.92 KB
Newer Older
Nicolas Widart's avatar
Nicolas Widart committed
1 2 3 4 5 6 7 8 9 10 11 12
//AdminLTE mixins
//===============

//Changes the color and the hovering properties of the navbar
.navbar-variant(@color; @font-color: rgba(255, 255, 255, 0.8); @hover-color: #f6f6f6; @hover-bg: rgba(0, 0, 0, 0.1)) {
  background-color: @color;
  //Navbar links
  .nav > li > a {
    color: @font-color;
  }

  .nav > li > a:hover,
13 14 15 16 17 18
  .nav > li > a:active,
  .nav > li > a:focus,
  .nav .open > a,
  .nav .open > a:hover,
  .nav .open > a:focus,
  .nav > .active > a {
Nicolas Widart's avatar
Nicolas Widart committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    background: @hover-bg;
    color: @hover-color;
  }

  //Add color to the sidebar toggle button
  .sidebar-toggle {
    color: @font-color;
    &:hover {
      color: @hover-color;
      background: @hover-bg;
    }
  }
}

//Logo color variation
34
.logo-variant(@bg-color; @color: #fff; @border-bottom-color: transparent; @border-bottom-width: 0) {
Nicolas Widart's avatar
Nicolas Widart committed
35 36 37 38 39
  background-color: @bg-color;
  color: @color;
  border-bottom: @border-bottom-width solid @border-bottom-color;

  &:hover {
40
    background-color: darken(@bg-color, 1%);
Nicolas Widart's avatar
Nicolas Widart committed
41 42 43 44 45 46 47 48 49 50 51 52
  }
}

//Box solid color variantion creator
.box-solid-variant(@color; @text-color: #fff) {
  border: 1px solid @color;
  > .box-header {
    color: @text-color;
    background: @color;
    background-color: @color;
    a,
    .btn {
53
      color: @text-color;
Nicolas Widart's avatar
Nicolas Widart committed
54 55 56 57 58 59 60
    }
  }
}

//Direct Chat Variant
.direct-chat-variant(@bg-color; @color: #fff) {
  .right > .direct-chat-text {
61
    background: @bg-color;
Nicolas Widart's avatar
Nicolas Widart committed
62 63 64
    border-color: @bg-color;
    color: @color;
    &:after,
65
    &:before {
Nicolas Widart's avatar
Nicolas Widart committed
66 67 68 69 70 71 72 73 74
      border-left-color: @bg-color;
    }
  }
}

//border radius creator
.border-radius(@radius) {
  border-radius: @radius;
}
75

Nicolas Widart's avatar
Nicolas Widart committed
76
//Different radius each side
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
.border-radius(@top-left;
@top-right
;
@bottom-left
;
@bottom-right
)
{
  border-top-left-radius: @top-left
;
  border-top-right-radius: @top-right
;
  border-bottom-right-radius: @bottom-right
;
  border-bottom-left-radius: @bottom-left
;
Nicolas Widart's avatar
Nicolas Widart committed
93 94 95 96 97 98
}

//Gradient background
.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) {
  background: @color;
  background: -webkit-gradient(linear,
99 100 101 102
  left bottom,
  left top,
  color-stop(0, @start),
  color-stop(1, @stop));
Nicolas Widart's avatar
Nicolas Widart committed
103
  background: -ms-linear-gradient(bottom,
104 105
  @start,
  @stop);
Nicolas Widart's avatar
Nicolas Widart committed
106
  background: -moz-linear-gradient(center bottom,
107 108
  @start 0%,
  @stop 100%);
Nicolas Widart's avatar
Nicolas Widart committed
109
  background: -o-linear-gradient(@stop,
110
  @start);
Nicolas Widart's avatar
Nicolas Widart committed
111
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@stop,@start));
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
}

//Added 2.1.0
//Skins Mixins

//Dark Sidebar Mixin
.skin-dark-sidebar(@link-hover-border-color) {
  // Sidebar background color (Both .wrapper and .left-side are responsible for sidebar bg color)
  .wrapper,
  .main-sidebar,
  .left-side {
    background-color: @sidebar-dark-bg;
  }
  //User Panel (resides in the sidebar)
  .user-panel {
    > .info, > .info > a {
      color: #fff;
    }
  }
  //Sidebar Menu. First level links
  .sidebar-menu > li {
    //Section Headning
    &.header {
      color: lighten(@sidebar-dark-bg, 20%);
      background: darken(@sidebar-dark-bg, 4%);
    }
    //links
    > a {
      border-left: 3px solid transparent;
    }
    //Hover and active states
    &:hover > a, &.active > a {
      color: @sidebar-dark-hover-color;
      background: @sidebar-dark-hover-bg;
      border-left-color: @link-hover-border-color;
    }
    //First Level Submenu
    > .treeview-menu {
      margin: 0 1px;
      background: @sidebar-dark-submenu-bg;
    }
  }
  //All links within the sidebar menu
  .sidebar a {
    color: @sidebar-dark-color;
    &:hover {
      text-decoration: none;
    }
  }
  //All submenus
  .treeview-menu {
    > li {
      > a {
        color: @sidebar-dark-submenu-color;
      }
      &.active > a, > a:hover {
        color: @sidebar-dark-submenu-hover-color;
      }
    }
  }
  //The sidebar search form
  .sidebar-form {
    .border-radius(3px);
    border: 1px solid lighten(@sidebar-dark-bg, 10%);
    margin: 10px 10px;
    input[type="text"], .btn {
      box-shadow: none;
      background-color: lighten(@sidebar-dark-bg, 10%);
      border: 1px solid transparent;
      height: 35px;
182
      //.transition(all @transition-speed @transition-fn);
183 184 185 186
    }
    input[type="text"] {
      color: #666;
      .border-radius(2px, 0, 2px, 0);
187 188
      &:focus,
      &:focus + .input-group-btn .btn {
189 190 191 192 193
        background-color: #fff;
        color: #666;
      }
      &:focus + .input-group-btn .btn {
        border-left-color: #fff;
194

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
      }
    }
    .btn {
      color: #999;
      .border-radius(0, 2px, 0, 2px);
    }
  }
}

//Light Sidebar Mixin
.skin-light-sidebar(@icon-active-color) {
  // Sidebar background color (Both .wrapper and .left-side are responsible for sidebar bg color)
  .wrapper,
  .main-sidebar,
  .left-side {
    background-color: @sidebar-light-bg;
  }
  .content-wrapper,
  .main-footer {
214
    border-left: 1px solid @gray-lte;
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
  }
  //User Panel (resides in the sidebar)
  .user-panel {
    > .info, > .info > a {
      color: @sidebar-light-color;
    }
  }
  //Sidebar Menu. First level links
  .sidebar-menu > li {
    .transition(border-left-color .3s ease);
    //border-left: 3px solid transparent;
    //Section Headning
    &.header {
      color: lighten(@sidebar-light-color, 25%);
      background: @sidebar-light-bg;
    }
    //links
    > a {
      border-left: 3px solid transparent;
      font-weight: 600;
    }
    //Hover and active states
    &:hover > a,
    &.active > a {
      color: @sidebar-light-hover-color;
      background: @sidebar-light-hover-bg;
    }
    &:hover > a {

    }
    &.active {
      border-left-color: @icon-active-color;
      > a {
        font-weight: 600;
      }
    }
    //First Level Submenu
    > .treeview-menu {
      background: @sidebar-light-submenu-bg;
    }
  }
  //All links within the sidebar menu
  .sidebar a {
    color: @sidebar-light-color;
    &:hover {
      text-decoration: none;
    }
  }
  //All submenus
  .treeview-menu {
    > li {
      > a {
        color: @sidebar-light-submenu-color;
      }
      &.active > a,
      > a:hover {
        color: @sidebar-light-submenu-hover-color;
      }
      &.active > a {
        font-weight: 600;
      }
    }
  }
  //The sidebar search form
  .sidebar-form {
    .border-radius(3px);
281
    border: 1px solid @gray-lte;  //darken(@sidebar-light-bg, 5%);
282 283 284 285 286 287 288
    margin: 10px 10px;
    input[type="text"],
    .btn {
      box-shadow: none;
      background-color: #fff; //darken(@sidebar-light-bg, 3%);
      border: 1px solid transparent;
      height: 35px;
289
      //.transition(all @transition-speed @transition-fn);
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
    }
    input[type="text"] {
      color: #666;
      .border-radius(2px, 0, 2px, 0);
      &:focus,
      &:focus + .input-group-btn .btn {
        background-color: #fff;
        color: #666;
      }
      &:focus + .input-group-btn .btn {
        border-left-color: #fff;
      }
    }
    .btn {
      color: #999;
      .border-radius(0, 2px, 0, 2px);
    }
  }
  @media (min-width: @screen-sm-min) {
    &.sidebar-mini.sidebar-collapse {
      .sidebar-menu > li > .treeview-menu {
311
        border-left: 1px solid @gray-lte;
312 313 314 315
      }
    }
  }
}