mixins.less 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. //transform
  2. .transform(@transformation) {
  3. -moz-transform:@transformation;
  4. -webkit-transform:@transformation;
  5. -o-transform:@transformation;
  6. -ms-transform:@transformation;
  7. transform:@transformation;
  8. }
  9. .transform-origin(@origin) {
  10. -moz-transform-origin:@origin;
  11. -webkit-transform-origin:@origin;
  12. -o-transform-origin:@origin;
  13. -ms-transform-origin:@origin;
  14. transform-origin:@origin;
  15. }
  16. .border-radius(@r) {
  17. border-radius: @r;
  18. }
  19. .box-shadow(@shadow) {
  20. -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
  21. box-shadow: @shadow;
  22. }
  23. .text-color(@a) when (lightness(@a) >= 50%){
  24. color: #000000;
  25. }
  26. .text-color(@a) when (lightness(@a) < 50%){
  27. color: @white;
  28. }
  29. .text-color-heading(@a) when (lightness(@a) >= 50%){
  30. color: @baseHeadingcolor;
  31. }
  32. .text-color-heading(@a) when (lightness(@a) < 50%){
  33. color: @white;
  34. }
  35. // Transformations
  36. .scale(@ratio) {
  37. -webkit-transform: scale(@ratio);
  38. -ms-transform: scale(@ratio); // IE9 only
  39. -o-transform: scale(@ratio);
  40. transform: scale(@ratio);
  41. }
  42. .scale(@ratioX; @ratioY) {
  43. -webkit-transform: scale(@ratioX, @ratioY);
  44. -ms-transform: scale(@ratioX, @ratioY); // IE9 only
  45. -o-transform: scale(@ratioX, @ratioY);
  46. transform: scale(@ratioX, @ratioY);
  47. }
  48. .scaleX(@ratio) {
  49. -webkit-transform: scaleX(@ratio);
  50. -ms-transform: scaleX(@ratio); // IE9 only
  51. -o-transform: scaleX(@ratio);
  52. transform: scaleX(@ratio);
  53. }
  54. .scaleY(@ratio) {
  55. -webkit-transform: scaleY(@ratio);
  56. -ms-transform: scaleY(@ratio); // IE9 only
  57. -o-transform: scaleY(@ratio);
  58. transform: scaleY(@ratio);
  59. }
  60. .skew(@x; @y) {
  61. -webkit-transform: skewX(@x) skewY(@y);
  62. -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+
  63. -o-transform: skewX(@x) skewY(@y);
  64. transform: skewX(@x) skewY(@y);
  65. }
  66. .translate(@x; @y) {
  67. -webkit-transform: translate(@x, @y);
  68. -ms-transform: translate(@x, @y); // IE9 only
  69. -o-transform: translate(@x, @y);
  70. transform: translate(@x, @y);
  71. }
  72. .translate3d(@x; @y; @z) {
  73. -webkit-transform: translate3d(@x, @y, @z);
  74. transform: translate3d(@x, @y, @z);
  75. }
  76. .rotate(@degrees) {
  77. -webkit-transform: rotate(@degrees);
  78. -ms-transform: rotate(@degrees); // IE9 only
  79. -o-transform: rotate(@degrees);
  80. transform: rotate(@degrees);
  81. }
  82. .rotateX(@degrees) {
  83. -webkit-transform: rotateX(@degrees);
  84. -ms-transform: rotateX(@degrees); // IE9 only
  85. -o-transform: rotateX(@degrees);
  86. transform: rotateX(@degrees);
  87. }
  88. .rotateY(@degrees) {
  89. -webkit-transform: rotateY(@degrees);
  90. -ms-transform: rotateY(@degrees); // IE9 only
  91. -o-transform: rotateY(@degrees);
  92. transform: rotateY(@degrees);
  93. }
  94. .perspective(@perspective) {
  95. -webkit-perspective: @perspective;
  96. -moz-perspective: @perspective;
  97. perspective: @perspective;
  98. }
  99. .perspective-origin(@perspective) {
  100. -webkit-perspective-origin: @perspective;
  101. -moz-perspective-origin: @perspective;
  102. perspective-origin: @perspective;
  103. }
  104. .transform-origin(@origin) {
  105. -webkit-transform-origin: @origin;
  106. -moz-transform-origin: @origin;
  107. -ms-transform-origin: @origin; // IE9 only
  108. transform-origin: @origin;
  109. }
  110. // Transitions
  111. .transition(@transition) {
  112. -webkit-transition: @transition;
  113. -o-transition: @transition;
  114. transition: @transition;
  115. }
  116. .transition-property(@transition-property) {
  117. -webkit-transition-property: @transition-property;
  118. transition-property: @transition-property;
  119. }
  120. .transition-delay(@transition-delay) {
  121. -webkit-transition-delay: @transition-delay;
  122. transition-delay: @transition-delay;
  123. }
  124. .transition-duration(@transition-duration) {
  125. -webkit-transition-duration: @transition-duration;
  126. transition-duration: @transition-duration;
  127. }
  128. .transition-timing-function(@timing-function) {
  129. -webkit-transition-timing-function: @timing-function;
  130. transition-timing-function: @timing-function;
  131. }
  132. .transition-transform(@transition) {
  133. -webkit-transition: -webkit-transform @transition;
  134. -moz-transition: -moz-transform @transition;
  135. -o-transition: -o-transform @transition;
  136. transition: transform @transition;
  137. }
  138. .border-top-radius(@radius) {
  139. border-top-left-radius: @radius;
  140. border-top-right-radius: @radius;
  141. }
  142. .border-right-radius(@radius) {
  143. border-top-right-radius: @radius;
  144. border-bottom-right-radius: @radius;
  145. }
  146. .border-bottom-radius(@radius) {
  147. border-bottom-right-radius: @radius;
  148. border-bottom-left-radius: @radius;
  149. }
  150. .border-left-radius(@radius) {
  151. border-top-left-radius: @radius;
  152. border-bottom-left-radius: @radius;
  153. }
  154. // Panels
  155. .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {
  156. border-color: @border;
  157. & > .panel-heading {
  158. color: @heading-text-color;
  159. background-color: @heading-bg-color;
  160. border-color: @heading-border;
  161. + .panel-collapse > .panel-body {
  162. border-top-color: @border;
  163. }
  164. .badge {
  165. color: @heading-bg-color;
  166. background-color: @heading-text-color;
  167. }
  168. }
  169. & > .panel-footer {
  170. + .panel-collapse > .panel-body {
  171. border-bottom-color: @border;
  172. }
  173. }
  174. }
  175. .button-variant(@color; @background; @border) {
  176. color: @color;
  177. background-color: @background;
  178. border-color: @border;
  179. &:focus,
  180. &.focus {
  181. color: @color;
  182. background-color: darken(@background, 10%);
  183. border-color: darken(@border, 25%);
  184. }
  185. &:hover {
  186. color: @color;
  187. background-color: darken(@background, 10%);
  188. border-color: darken(@border, 12%);
  189. }
  190. &:active,
  191. &.active,
  192. .open > .dropdown-toggle& {
  193. color: @color;
  194. background-color: darken(@background, 10%);
  195. background-image: none;
  196. border-color: darken(@border, 12%);
  197. &:hover,
  198. &:focus,
  199. &.focus {
  200. color: @color;
  201. background-color: darken(@background, 17%);
  202. border-color: darken(@border, 25%);
  203. }
  204. }
  205. &.disabled,
  206. &[disabled],
  207. fieldset[disabled] & {
  208. &:hover,
  209. &:focus,
  210. &.focus {
  211. background-color: @background;
  212. border-color: @border;
  213. }
  214. }
  215. .badge {
  216. color: @background;
  217. background-color: @color;
  218. }
  219. }