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