label-badge.less 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. @label-text: #FFF;
  2. @label-yellow-text: #996633;
  3. @label-light-text: #888;
  4. //labels & badges
  5. .label {
  6. border-radius: 0;
  7. text-shadow: none;
  8. font-weight: normal;
  9. color: @label-text;
  10. display: inline-block;
  11. background-color: @label-default;// !important;
  12. &[class*="col-"][class*="arrow"] {
  13. min-height:0;
  14. }
  15. }
  16. @media screen and (-webkit-min-device-pixel-ratio:0) {
  17. //default display:none causes problems with Android Webview
  18. ::safari-only,.label:empty {
  19. display: inline-block;
  20. }
  21. ::safari-only,.badge:empty {
  22. display: inline-block;
  23. }
  24. }
  25. .badge {
  26. text-shadow: none;
  27. font-size: @font-size-badge;
  28. padding-top: 1px;
  29. padding-bottom: 3px;
  30. font-weight: normal;
  31. line-height: 15px;
  32. background-color: @label-default;//!important;
  33. &.no-radius { border-radius: 0; }
  34. &.radius-1 { border-radius: 1px; }
  35. &.radius-2 { border-radius: 2px; }
  36. &.radius-3 { border-radius: 3px; }
  37. &.radius-4 { border-radius: 4px; }
  38. &.radius-5 { border-radius: 5px; }
  39. &.radius-6 { border-radius: 6px; }
  40. }
  41. .label.label-transparent, .label-transparent, .badge.badge-transparent, .badge-transparent {
  42. background-color: transparent;//!important;
  43. }
  44. .enable_label_colors() when(@enable-label-colors = true) {
  45. //labels
  46. .label-color(@color) {
  47. @label-class:~`"label-@{color}"`;
  48. @badge-class:~`"badge-@{color}"`;
  49. @label-color:@@label-class;
  50. .@{label-class}, .label.@{label-class}, .badge.@{badge-class}, .@{badge-class} {
  51. background-color:@label-color;//!important;
  52. }
  53. }
  54. .label-color(~"grey");
  55. .label-color(~"info");
  56. .label-color(~"primary");
  57. .label-color(~"success");
  58. .label-color(~"danger");
  59. .label-color(~"important");
  60. .label-color(~"inverse");
  61. .label-color(~"warning");
  62. .label-color(~"pink");
  63. .label-color(~"purple");
  64. .label-color(~"yellow");
  65. .label-color(~"light");
  66. .badge-yellow, .label-yellow {
  67. color: @label-yellow-text;// !important;
  68. border-color: @label-yellow;
  69. }
  70. .badge-light, .label-light {
  71. color: @label-light-text;// !important;
  72. }
  73. .label.arrowed , .label.arrowed-in {
  74. position:relative;
  75. z-index: 1;
  76. &:before {
  77. display: inline-block;
  78. content: "";
  79. position: absolute;
  80. top: 0;
  81. z-index: -1;
  82. border: 1px solid transparent;
  83. border-right-color: @label-default;
  84. -moz-border-right-colors: @label-default;
  85. }
  86. }
  87. .label.arrowed-in:before {
  88. border-color: @label-default;
  89. border-left-color: transparent;
  90. -moz-border-left-colors: none;
  91. }
  92. .label.arrowed-right , .label.arrowed-in-right {
  93. position: relative;
  94. z-index: 1;
  95. &:after {
  96. display: inline-block;
  97. content: "";
  98. position: absolute;
  99. top: 0;
  100. z-index: -1;
  101. border: 1px solid transparent;
  102. border-left-color: @label-default;
  103. -moz-border-left-colors: @label-default;
  104. }
  105. }
  106. .label.arrowed-in-right:after {
  107. border-color: @label-default;
  108. border-right-color: transparent;
  109. -moz-border-right-colors: none;
  110. }
  111. .label-arrow(@color) {
  112. @label-class:~`"label-@{color}"`;
  113. @label-color:@@label-class;
  114. .@{label-class}{
  115. &.arrowed:before {
  116. border-right-color: @label-color;
  117. -moz-border-right-colors: @label-color;
  118. }
  119. &.arrowed-in:before {
  120. border-color: @label-color @label-color @label-color transparent;
  121. -moz-border-right-colors: @label-color;
  122. }
  123. &.arrowed-right:after {
  124. border-left-color: @label-color;
  125. -moz-border-left-colors: @label-color;
  126. }
  127. &.arrowed-in-right:after {
  128. border-color: @label-color transparent @label-color @label-color;
  129. -moz-border-left-colors: @label-color;
  130. }
  131. }
  132. }
  133. .label-arrow(~"info");
  134. .label-arrow(~"primary");
  135. .label-arrow(~"success");
  136. .label-arrow(~"warning");
  137. .label-arrow(~"important");
  138. .label-arrow(~"danger");
  139. .label-arrow(~"inverse");
  140. .label-arrow(~"pink");
  141. .label-arrow(~"purple");
  142. .label-arrow(~"yellow");
  143. .label-arrow(~"light");
  144. .label-arrow(~"grey");
  145. .label {
  146. .label-size(12px, 1.15, 20px, 10px, 5px);
  147. }
  148. .label-lg {
  149. padding:0.3em 0.6em 0.4em;
  150. .label-size(13px, 1.1, 24px, 12px, 6px);
  151. }
  152. .label-xlg {
  153. padding:0.3em 0.7em 0.4em;
  154. .label-size(14px, 1.3, 28px, 14px, 7px);
  155. }
  156. .label-sm {
  157. padding:0.2em 0.4em 0.3em;
  158. .label-size(11px, 1, 18px, 9px, 4px);
  159. }
  160. .label > span , .label > .@{icon} {
  161. line-height: 1;
  162. vertical-align: bottom;
  163. }
  164. .label-size(@font-size, @line-height, @height, @border-height, @border-width) {
  165. font-size: @font-size;
  166. line-height: @line-height;
  167. height: @height;
  168. &.arrowed {
  169. margin-left: @border-width;
  170. &:before {
  171. left: -(@border-width * 2);
  172. border-width: @border-height @border-width;
  173. }
  174. }
  175. &.arrowed-in {
  176. margin-left: (@border-width);
  177. &:before {
  178. left: -@border-width;
  179. border-width: @border-height @border-width;
  180. }
  181. }
  182. &.arrowed-right {
  183. margin-right: @border-width;
  184. &:after {
  185. right: -(@border-width * 2);
  186. border-width: @border-height @border-width;
  187. }
  188. }
  189. &.arrowed-in-right {
  190. margin-right: (@border-width);
  191. &:after {
  192. right: -@border-width;
  193. border-width: @border-height @border-width;
  194. }
  195. }
  196. }
  197. .enable_label_white_colors() when(@enable-label-white-colors = true) {
  198. .label.label-white {
  199. color: darken(@label-default, 12%);
  200. border:1px solid @label-default;
  201. background-color: lighten(@label-default, 24%);// !important;
  202. border-right-width: 1px;
  203. border-left-width: 2px;
  204. }
  205. .label-white(@txt-color, @border-color, @bg-hover-color) {
  206. color: @txt-color;
  207. border-color: @border-color;
  208. background-color: @bg-hover-color;// !important;
  209. }
  210. .label-white.label-success {
  211. .label-white(desaturate(darken(@label-success , 4%) , 8%), desaturate(lighten(@label-success , 10%), 2%) , desaturate(lighten(@label-success , 37.5%), 0%));
  212. }
  213. .label-white.label-warning {
  214. .label-white(desaturate(lighten(@label-warning , 5%), 28%), desaturate(lighten(@label-warning , 14%), 25%) , desaturate(lighten(@label-warning , 46%), 5%));
  215. }
  216. .label-white.label-primary {
  217. .label-white(desaturate(@label-primary , 30%), desaturate(lighten(@label-primary , 15%), 15%) , desaturate(lighten(@label-primary , 42%), 6%));
  218. }
  219. .label-white.label-danger {
  220. .label-white(desaturate(lighten(@label-danger, 5%) , 25%), desaturate(lighten(@label-danger , 10%), 10%) , desaturate(lighten(@label-danger , 42%), 1%));
  221. }
  222. .label-white.label-info {
  223. .label-white(desaturate(darken(@label-info, 2%) , 20%), desaturate(lighten(@label-info , 14%), 22%) , desaturate(lighten(@label-info , 49%), 6%));
  224. }
  225. .label-white.label-inverse {
  226. .label-white(lighten(@label-inverse, 5%), lighten(@label-inverse , 25%) , lighten(@label-inverse , 73%));
  227. }
  228. .label-white.label-pink {
  229. .label-white(desaturate(@label-pink , 35%), desaturate(lighten(@label-pink , 15%), 25%) , desaturate(lighten(@label-pink , 40%), 5%));
  230. }
  231. .label-white.label-purple {
  232. .label-white(darken(desaturate(@label-purple , 10%) , 10%), desaturate(lighten(@label-purple , 10%), 15%) , desaturate(lighten(@label-purple , 31%), 5%));
  233. }
  234. .label-white.label-yellow {
  235. .label-white(darken(desaturate(@label-yellow , 16%) , 32%), desaturate(darken(@label-yellow, 5%), 25%) , desaturate(lighten(@label-yellow , 18%), 10%));
  236. }
  237. .label-white.label-grey {
  238. .label-white(darken(@label-grey , 10%), lighten(@label-grey , 18%) , lighten(@label-grey , 30%));
  239. }
  240. }
  241. .enable_label_white_colors();
  242. //fix zooming of arrowed labels
  243. .label:not(.label-lg):not(.label-xlg):not(.label-sm) {
  244. @media
  245. screen and (-webkit-min-device-pixel-ratio: 1.08) and (-webkit-max-device-pixel-ratio: 1.15),
  246. screen and (min--moz-device-pixel-ratio: 1.08) and (max--moz-device-pixel-ratio: 1.15)
  247. {
  248. &.arrowed:before {
  249. border-width: 10.5px 6px;
  250. left: -11px;
  251. }
  252. &.arrowed-right:after {
  253. border-width: 10.5px 6px;
  254. right: -11px;
  255. }
  256. &.arrowed-in:before {
  257. border-width: 10.5px 5px 10px;
  258. left: -6px;
  259. }
  260. &.arrowed-in-right:after {
  261. border-width: 10.5px 5px 10px;
  262. right: -6px;
  263. }
  264. }
  265. @media
  266. screen and (-webkit-min-device-pixel-ratio: 1.3) and (-webkit-max-device-pixel-ratio: 1.4),
  267. screen and (min--moz-device-pixel-ratio: 1.3) and (max--moz-device-pixel-ratio: 1.4)
  268. {
  269. &.arrowed:before {
  270. border-width: 10px 6px 10px;
  271. left: -12px;
  272. }
  273. &.arrowed-right:after {
  274. border-width: 10px 6px 10px;
  275. right: -12px;
  276. }
  277. &.arrowed-in:before {
  278. border-width: 10px 5px 10px;
  279. left: -6px;
  280. }
  281. &.arrowed-in-right:after {
  282. border-width: 10px 5px 10px;
  283. right: -6px;
  284. }
  285. }
  286. @media
  287. screen and (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 1.6),
  288. screen and (min--moz-device-pixel-ratio: 1.5) and (max--moz-device-pixel-ratio: 1.6)
  289. {
  290. &.arrowed:before {
  291. border-width: 10px 6px;
  292. left: -12px;
  293. }
  294. &.arrowed-right:after {
  295. border-width: 10px 6px;
  296. right: -12px;
  297. }
  298. }
  299. @media
  300. screen and (-webkit-min-device-pixel-ratio: 1.7) and (-webkit-max-device-pixel-ratio: 1.8),
  301. screen and (min--moz-device-pixel-ratio: 1.7) and (max--moz-device-pixel-ratio: 1.8)
  302. {
  303. &.arrowed:before {
  304. border-width: 10px 6px;
  305. left: -11.5px;
  306. }
  307. &.arrowed-right:after {
  308. border-width: 10px 6px;
  309. right: -11.5px;
  310. }
  311. &.arrowed-in:before {
  312. border-width: 10px 5px;
  313. left: -6px;
  314. }
  315. &.arrowed-in-right:after {
  316. border-width: 10px 5px;
  317. right: -6px;
  318. }
  319. }
  320. @media
  321. screen and (-webkit-min-device-pixel-ratio: 0.8) and (-webkit-max-device-pixel-ratio: 0.9),
  322. screen and (min--moz-device-pixel-ratio: 0.8) and (max--moz-device-pixel-ratio: 0.9)
  323. {
  324. &.arrowed:before {
  325. border-width: 11px 6px;
  326. left: -11.5px;
  327. }
  328. &.arrowed-right:after {
  329. border-width: 11px 6px;
  330. right: -11.5px;
  331. }
  332. &.arrowed-in:before {
  333. border-width: 11px 5px;
  334. left: -6px;
  335. }
  336. &.arrowed-in-right:after {
  337. border-width: 11px 5px;
  338. right: -6px;
  339. }
  340. }
  341. }//.label:not(.label-lg)
  342. .label-lg {
  343. @media
  344. screen and (-webkit-min-device-pixel-ratio: 1.08) and (-webkit-max-device-pixel-ratio: 1.15),
  345. screen and (min--moz-device-pixel-ratio: 1.08) and (max--moz-device-pixel-ratio: 1.15)
  346. {
  347. &.arrowed:before {
  348. left: -11px;
  349. }
  350. &.arrowed-right:after {
  351. right: -11px;
  352. }
  353. }
  354. @media
  355. screen and (-webkit-min-device-pixel-ratio: 1.7) and (-webkit-max-device-pixel-ratio: 1.8),
  356. screen and (min--moz-device-pixel-ratio: 1.7) and (max--moz-device-pixel-ratio: 1.8)
  357. {
  358. &.arrowed:before {
  359. left: -11.5px;
  360. }
  361. &.arrowed-right:after {
  362. right: -11.5px;
  363. }
  364. &.arrowed-in:before {
  365. border-width: 12.5px 6px 12px;
  366. left: -6px;
  367. }
  368. &.arrowed-in-right:after {
  369. border-width: 12.5px 6px 12px;
  370. right: -6px;
  371. }
  372. }
  373. }//.label-lg
  374. .label-xlg {
  375. @media
  376. screen and (-webkit-min-device-pixel-ratio: 1.08) and (-webkit-max-device-pixel-ratio: 1.15),
  377. screen and (min--moz-device-pixel-ratio: 1.08) and (max--moz-device-pixel-ratio: 1.15)
  378. {
  379. &.arrowed:before {
  380. left: -13px;
  381. }
  382. &.arrowed-right:after {
  383. right: -13px;
  384. }
  385. &.arrowed-in:before {
  386. border-width: 14px 7px 14.5px;
  387. }
  388. &.arrowed-in-right:after {
  389. border-width: 14px 7px 14.5px;
  390. }
  391. }
  392. @media
  393. screen and (-webkit-min-device-pixel-ratio: 1.2) and (-webkit-max-device-pixel-ratio: 1.3),
  394. screen and (min--moz-device-pixel-ratio: 1.2) and (max--moz-device-pixel-ratio: 1.3)
  395. {
  396. &.arrowed:before {
  397. border-width: 14.5px 7px;
  398. left: -13.5px;
  399. }
  400. &.arrowed-right:after {
  401. border-width: 14.5px 7px;
  402. right: -13.5px;
  403. }
  404. &.arrowed-in:before {
  405. border-width: 14.5px 7px 14.5px;
  406. }
  407. &.arrowed-in-right:after {
  408. border-width: 14.5px 7px 14.5px;
  409. }
  410. }
  411. @media
  412. screen and (-webkit-min-device-pixel-ratio: 1.3) and (-webkit-max-device-pixel-ratio: 1.4),
  413. screen and (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 1.6),
  414. screen and (min--moz-device-pixel-ratio: 1.3) and (max--moz-device-pixel-ratio: 1.4),
  415. screen and (min--moz-device-pixel-ratio: 1.5) and (max--moz-device-pixel-ratio: 1.6)
  416. {
  417. &.arrowed:before {
  418. border-width: 14.5px 7.5px;
  419. left: -14.5px;
  420. }
  421. &.arrowed-right:after {
  422. border-width: 14.5px 7.5px;
  423. right: -14.5px;
  424. }
  425. &.arrowed-in:before {
  426. border-width: 14.5px 7px;
  427. }
  428. &.arrowed-in-right:after {
  429. border-width: 14.5px 7px;
  430. }
  431. }
  432. }//.label-xlg
  433. .label-sm {
  434. @media
  435. screen and (-webkit-min-device-pixel-ratio: 1.08) and (-webkit-max-device-pixel-ratio: 1.15),
  436. screen and (min--moz-device-pixel-ratio: 1.08) and (max--moz-device-pixel-ratio: 1.15)
  437. {
  438. &.arrowed:before {
  439. border-width: 9px 5px;
  440. left: -9px;
  441. }
  442. &.arrowed-right:after {
  443. border-width: 9px 5px;
  444. right: -9px;
  445. }
  446. &.arrowed-in:before {
  447. border-width: 10px 4px;
  448. }
  449. &.arrowed-in-right:after {
  450. border-width: 10px 4px;
  451. }
  452. }
  453. @media
  454. screen and (-webkit-min-device-pixel-ratio: 1.2) and (-webkit-max-device-pixel-ratio: 1.3),
  455. screen and (min--moz-device-pixel-ratio: 1.2) and (max--moz-device-pixel-ratio: 1.3)
  456. {
  457. &.arrowed:before {
  458. border-width: 9.5px 5px;
  459. left: -10px;
  460. }
  461. &.arrowed-right:after {
  462. border-width: 9.5px 5px;
  463. right: -10px;
  464. }
  465. &.arrowed-in:before {
  466. border-width: 9.5px 4px;
  467. }
  468. &.arrowed-in-right:after {
  469. border-width: 9.5px 4px;
  470. }
  471. }
  472. }//.label-sm
  473. }
  474. .enable_label_colors();