|
| 1 | +/* Tablesorter Custom Bootstrap v3 LESS Theme by Rob Garrison |
| 2 | +
|
| 3 | +To create your own theme, modify the code below and run it through |
| 4 | +a LESS compiler, like this one: http://leafo.net/lessphp/editor.html |
| 5 | +or download less.js from http://lesscss.org/ |
| 6 | +
|
| 7 | +Test out these customization files live |
| 8 | + Basic LESS Theme : http://codepen.io/Mottie/pen/eqBbn |
| 9 | + Bootstrap LESS : http://codepen.io/Mottie/pen/Ltzpi |
| 10 | + Metro LESS Style : http://codepen.io/Mottie/pen/gCslk |
| 11 | + Basic SCSS : http://codepen.io/Mottie/pen/LbXdNR |
| 12 | +
|
| 13 | +*/ |
| 14 | + |
| 15 | +/*** theme ***/ |
| 16 | +@theme : tablesorter-bootstrap; |
| 17 | + |
| 18 | +/*** fonts ***/ |
| 19 | +@tableHeaderFont : 14px bold Arial, Sans-serif; |
| 20 | +@tableBodyFont : 14px "Helvetica Neue", Helvetica, Arial, sans-serif; |
| 21 | + |
| 22 | +/*** color definitions ***/ |
| 23 | +/* for best results, only change the hue (240), |
| 24 | + leave the saturation (60%) and luminosity (80%) alone |
| 25 | + pick the color from here: http://hslpicker.com/#99E699 */ |
| 26 | +@headerBackground : hsl(240, 60%, 80%); |
| 27 | +@borderAndBackground : #cdcdcd; |
| 28 | +@overallBorder : @borderAndBackground 1px solid; |
| 29 | +@headerTextColor : #000; |
| 30 | + |
| 31 | +@bodyBackground : #fff; |
| 32 | +@bodyTextColor : #000; |
| 33 | + |
| 34 | +@headerAsc : darken(spin(@headerBackground, 5), 10%); /* darken(@headerBackground, 10%); */ |
| 35 | +@headerDesc : lighten(spin(@headerBackground, -5), 10%); /* desaturate(@headerAsc, 5%); */ |
| 36 | + |
| 37 | +@captionBackground : #fff; /* it might be best to match the document body background color here */ |
| 38 | +@errorBackground : #e6bf99; /* ajax error message (added to thead) */ |
| 39 | + |
| 40 | +@filterCellBackground : #eee; |
| 41 | +@filterElementTextColor: #333; |
| 42 | +@filterElementBkgd : #fff; |
| 43 | +@filterElementBorder : 1px solid #bbb; |
| 44 | +@filterTransitionTime : 0.1s; |
| 45 | +@filterRowHiddenHeight : 4px; /* becomes height using padding (so it's divided by 2) */ |
| 46 | + |
| 47 | +@overallPadding : 4px; |
| 48 | +/* 20px should be slightly wider than the icon width to avoid overlap */ |
| 49 | +@headerPadding : 4px 20px 4px 4px; |
| 50 | +@headerMargin : 0 0 18px; |
| 51 | + |
| 52 | +/* url(icons/loading.gif); */ |
| 53 | +@processingIcon : url('data:image/gif;base64,R0lGODlhFAAUAKEAAO7u7lpaWgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgACACwAAAAAFAAUAAACQZRvoIDtu1wLQUAlqKTVxqwhXIiBnDg6Y4eyx4lKW5XK7wrLeK3vbq8J2W4T4e1nMhpWrZCTt3xKZ8kgsggdJmUFACH5BAEKAAIALAcAAAALAAcAAAIUVB6ii7jajgCAuUmtovxtXnmdUAAAIfkEAQoAAgAsDQACAAcACwAAAhRUIpmHy/3gUVQAQO9NetuugCFWAAAh+QQBCgACACwNAAcABwALAAACE5QVcZjKbVo6ck2AF95m5/6BSwEAIfkEAQoAAgAsBwANAAsABwAAAhOUH3kr6QaAcSrGWe1VQl+mMUIBACH5BAEKAAIALAIADQALAAcAAAIUlICmh7ncTAgqijkruDiv7n2YUAAAIfkEAQoAAgAsAAAHAAcACwAAAhQUIGmHyedehIoqFXLKfPOAaZdWAAAh+QQFCgACACwAAAIABwALAAACFJQFcJiXb15zLYRl7cla8OtlGGgUADs='); |
| 54 | + |
| 55 | +/* zebra striping */ |
| 56 | +.allRows { |
| 57 | + background-color: @bodyBackground; |
| 58 | + color: @bodyTextColor; |
| 59 | +} |
| 60 | +.evenRows { |
| 61 | + background-color: lighten(@headerBackground, 35%); |
| 62 | +} |
| 63 | +.oddRows { |
| 64 | + background-color: lighten(@headerBackground, 18%); |
| 65 | +} |
| 66 | + |
| 67 | +/* hovered rows */ |
| 68 | +.oddHovered { |
| 69 | + background-color: desaturate(@headerBackground, 60%); |
| 70 | +} |
| 71 | +.evenHovered { |
| 72 | + background-color: lighten( desaturate(@headerBackground, 60%), 10% ); |
| 73 | +} |
| 74 | + |
| 75 | +/* Columns widget */ |
| 76 | +@primaryOdd : spin(@headerBackground, 10); /* saturate( darken( desaturate(@headerBackground, 10%), 10% ), 30%); */ |
| 77 | +@primaryEven : lighten( @primaryOdd, 10% ); |
| 78 | +@secondaryOdd : @primaryEven; |
| 79 | +@secondaryEven : lighten( @primaryEven, 5% ); |
| 80 | +@tertiaryOdd : @secondaryEven; |
| 81 | +@tertiaryEven : lighten( @secondaryEven, 5% ); |
| 82 | + |
| 83 | +/* Filter widget transition */ |
| 84 | +.filterWidgetTransition { |
| 85 | + -webkit-transition: line-height @filterTransitionTime ease; |
| 86 | + -moz-transition: line-height @filterTransitionTime ease; |
| 87 | + -o-transition: line-height @filterTransitionTime ease; |
| 88 | + transition: line-height @filterTransitionTime ease; |
| 89 | +} |
| 90 | + |
| 91 | +/*** icon block ***/ |
| 92 | +.iconPosition { |
| 93 | + font-size: 11px; |
| 94 | + position: absolute; |
| 95 | + right: 2px; |
| 96 | + top: 50%; |
| 97 | + margin-top: -7px; /* half the icon height; older IE doesn't like this */ |
| 98 | + width: 14px; |
| 99 | + height: 14px; |
| 100 | + background-repeat: no-repeat; |
| 101 | + line-height: 14px; |
| 102 | +} |
| 103 | + |
| 104 | +/* black */ |
| 105 | +@unsortedBlack : url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAOCAYAAAD5YeaVAAAA20lEQVR4AWJABpKSkoxALCstLb0aUAsZaCAMhVEY6B0amx8YZWDDEDSBa2AGe7XeIiAAClYwVGBvsAcIllsf/mvcC9DgOOd8h90fxWvngVEUbZIkuWRZZlE8eQjcisgZMM9zi+LJ6ZfwegmWZflZDugdHMfxTcGqql7TNBlUB/QObtv2VBSFrev6OY7jngzFk9OT/fn73fWYpqnlXNyXDMWT0zuYx/Bvel9ej+LJ6R08DMOu67q7DkTkrSA5vYPneV71fX/QASdTkJwezhs0TfMARn0wMDDGXEPgF4oijqwM5YjNAAAAAElFTkSuQmCC); |
| 106 | + |
| 107 | +/* white */ |
| 108 | +@unsortedWhite : url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAOCAYAAAD5YeaVAAAAe0lEQVR4AbXQoRWDMBiF0Sh2QLAAQ8SxJGugWSA6A2STW1PxTsnB9cnkfuYvv8OGC1t5G3Y0QMP+Bm857keAdQIzWBP3+Bw4MADQE18B6/etRnCV/w9nnGuLezfAmXhABGtAGIkruvk6auIFRwQJDywllsEAjCecB20GP59BQQ+gtlRLAAAAAElFTkSuQmCC); |
| 109 | + |
| 110 | +/* automatically choose the correct arrow/text color */ |
| 111 | +.headerText (@a) when (lightness(@a) >= 50%) { |
| 112 | + color: @headerTextColor; |
| 113 | +} |
| 114 | +.headerText (@a) when (lightness(@a) < 50%) { |
| 115 | + color: lighten(@headerTextColor, 90%); |
| 116 | +} |
| 117 | +.unsorted (@a) when (lightness(@a) >= 50%) { |
| 118 | + background-image: @unsortedBlack; |
| 119 | + color: @headerTextColor; |
| 120 | +} |
| 121 | +.unsorted (@a) when (lightness(@a) < 50%) { |
| 122 | + background-image: @unsortedWhite; |
| 123 | + color: lighten(@headerTextColor, 90%); |
| 124 | +} |
| 125 | + |
| 126 | +/* variable theme name - requires less.js 1.3+; |
| 127 | + or just replace (!".@{theme}") with the contents of @theme |
| 128 | +*/ |
| 129 | +.@{theme} { |
| 130 | + font: @tableBodyFont; |
| 131 | + background-color: @borderAndBackground; |
| 132 | + width: 100%; |
| 133 | + |
| 134 | + /* style th's outside of the thead */ |
| 135 | + th, thead td { |
| 136 | + font: @tableHeaderFont; |
| 137 | + font-weight: bold; |
| 138 | + background-color: @headerBackground; |
| 139 | + .headerText(@headerBackground); |
| 140 | + border-collapse: collapse; |
| 141 | + margin: @headerMargin; |
| 142 | + padding: @overallPadding; |
| 143 | + } |
| 144 | + |
| 145 | + tbody td, tfoot th, tfoot td { |
| 146 | + padding: @overallPadding; |
| 147 | + vertical-align: top; |
| 148 | + } |
| 149 | + |
| 150 | + /* style header */ |
| 151 | + .tablesorter-header { |
| 152 | + cursor: pointer; |
| 153 | + } |
| 154 | + |
| 155 | + .tablesorter-header-inner { |
| 156 | + position: relative; |
| 157 | + padding: @headerPadding; |
| 158 | + } |
| 159 | + |
| 160 | + /* bootstrap uses <i> for icons */ |
| 161 | + .tablesorter-header-inner i.tablesorter-icon { |
| 162 | + .iconPosition |
| 163 | + } |
| 164 | + |
| 165 | + .tablesorter-header.sorter-false { |
| 166 | + cursor: default; |
| 167 | + |
| 168 | + i.tablesorter-icon { |
| 169 | + display: none; |
| 170 | + } |
| 171 | + .tablesorter-header-inner { |
| 172 | + padding: @overallPadding; |
| 173 | + } |
| 174 | + } |
| 175 | + |
| 176 | + .tablesorter-headerAsc { |
| 177 | + background-color: @headerAsc; |
| 178 | + } |
| 179 | + |
| 180 | + .tablesorter-headerDesc { |
| 181 | + background-color: @headerDesc; |
| 182 | + } |
| 183 | + |
| 184 | + .bootstrap-icon-unsorted { |
| 185 | + .unsorted(@headerBackground); |
| 186 | + } |
| 187 | + |
| 188 | + |
| 189 | + /* tfoot */ |
| 190 | + tfoot .tablesorter-headerAsc, |
| 191 | + tfoot .tablesorter-headerDesc { |
| 192 | + /* remove sort arrows from footer */ |
| 193 | + background-image: none; |
| 194 | + } |
| 195 | + |
| 196 | + /* optional disabled input styling */ |
| 197 | + .disabled { |
| 198 | + opacity: 0.5; |
| 199 | + filter: alpha(opacity=50); |
| 200 | + cursor: not-allowed; |
| 201 | + } |
| 202 | + |
| 203 | + /* body */ |
| 204 | + tbody { |
| 205 | + |
| 206 | + td { |
| 207 | + .allRows; |
| 208 | + padding: @overallPadding; |
| 209 | + vertical-align: top; |
| 210 | + } |
| 211 | + |
| 212 | + /* Zebra Widget - row alternating colors */ |
| 213 | + tr.odd > td { |
| 214 | + .oddRows; |
| 215 | + } |
| 216 | + tr.even > td { |
| 217 | + .evenRows; |
| 218 | + } |
| 219 | + |
| 220 | + } |
| 221 | + |
| 222 | + /* hovered row colors |
| 223 | + you'll need to add additional lines for |
| 224 | + rows with more than 2 child rows |
| 225 | + */ |
| 226 | + tbody > tr.hover > td, |
| 227 | + tbody > tr:hover > td, |
| 228 | + tbody > tr:hover + tr.tablesorter-childRow > td, |
| 229 | + tbody > tr:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td, |
| 230 | + tbody > tr.even.hover > td, |
| 231 | + tbody > tr.even:hover > td, |
| 232 | + tbody > tr.even:hover + tr.tablesorter-childRow > td, |
| 233 | + tbody > tr.even:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td { |
| 234 | + .evenHovered; |
| 235 | + } |
| 236 | + tbody > tr.odd.hover > td, |
| 237 | + tbody > tr.odd:hover > td, |
| 238 | + tbody > tr.odd:hover + tr.tablesorter-childRow > td, |
| 239 | + tbody > tr.odd:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td { |
| 240 | + .oddHovered; |
| 241 | + } |
| 242 | + |
| 243 | + /* table processing indicator - indeterminate spinner */ |
| 244 | + .tablesorter-processing { |
| 245 | + background-image: @processingIcon; |
| 246 | + background-position: center center; |
| 247 | + background-repeat: no-repeat; |
| 248 | + } |
| 249 | + |
| 250 | + /* Column Widget - column sort colors */ |
| 251 | + tr.odd td.primary { |
| 252 | + background-color: @primaryOdd; |
| 253 | + } |
| 254 | + td.primary, tr.even td.primary { |
| 255 | + background-color: @primaryEven; |
| 256 | + } |
| 257 | + tr.odd td.secondary { |
| 258 | + background-color: @secondaryOdd; |
| 259 | + } |
| 260 | + td.secondary, tr.even td.secondary { |
| 261 | + background-color: @secondaryEven; |
| 262 | + } |
| 263 | + tr.odd td.tertiary { |
| 264 | + background-color: @tertiaryOdd; |
| 265 | + } |
| 266 | + td.tertiary, tr.even td.tertiary { |
| 267 | + background-color: @tertiaryEven; |
| 268 | + } |
| 269 | + |
| 270 | + /* caption (non-theme matching) */ |
| 271 | + caption { |
| 272 | + background-color: @captionBackground ; |
| 273 | + } |
| 274 | + |
| 275 | + /* filter widget */ |
| 276 | + .tablesorter-filter-row input, |
| 277 | + .tablesorter-filter-row select{ |
| 278 | + width: 98%; |
| 279 | + margin: 0; |
| 280 | + padding: @overallPadding; |
| 281 | + color: @filterElementTextColor; |
| 282 | + background-color: @filterElementBkgd; |
| 283 | + border: @filterElementBorder; |
| 284 | + -webkit-box-sizing: border-box; |
| 285 | + -moz-box-sizing: border-box; |
| 286 | + box-sizing: border-box; |
| 287 | + .filterWidgetTransition; |
| 288 | + } |
| 289 | + .tablesorter-filter-row { |
| 290 | + background-color: @filterCellBackground; |
| 291 | + } |
| 292 | + .tablesorter-filter-row td { |
| 293 | + text-align: center; |
| 294 | + background-color: @filterCellBackground; |
| 295 | + line-height: normal; |
| 296 | + text-align: center; /* center the input */ |
| 297 | + .filterWidgetTransition; |
| 298 | + } |
| 299 | + /* hidden filter row */ |
| 300 | + .tablesorter-filter-row.hideme td { |
| 301 | + padding: @filterRowHiddenHeight / 2; |
| 302 | + margin: 0; |
| 303 | + line-height: 0; |
| 304 | + cursor: pointer; |
| 305 | + } |
| 306 | + .tablesorter-filter-row.hideme * { |
| 307 | + height: 1px; |
| 308 | + min-height: 0; |
| 309 | + border: 0; |
| 310 | + padding: 0; |
| 311 | + margin: 0; |
| 312 | + /* don't use visibility: hidden because it disables tabbing */ |
| 313 | + opacity: 0; |
| 314 | + filter: alpha(opacity=0); |
| 315 | + } |
| 316 | + /* rows hidden by filtering (needed for child rows) */ |
| 317 | + .filtered { |
| 318 | + display: none; |
| 319 | + } |
| 320 | + |
| 321 | + /* ajax error row */ |
| 322 | + .tablesorter-errorRow td { |
| 323 | + text-align: center; |
| 324 | + cursor: pointer; |
| 325 | + background-color: @errorBackground; |
| 326 | + } |
| 327 | + |
| 328 | +} |
0 commit comments