Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.64 KB | None | 0 0
  1. // Juice v0.0.8
  2. // ------------
  3.  
  4. // ----------------------------------
  5. // Variable settings
  6. // ----------------------------------
  7.  
  8. // Base px
  9. $base-px-default: 16px !default;
  10. // Breakpoints
  11. $hdpi-ratio-default: 1.3 !default;
  12. // Border Radius
  13. $border-radius-default: 5px !default;
  14. // Placeholder Color
  15. $placeholder-color-default: #555555 !default;
  16. // Triangle
  17. $triangle-direction-default: right !default;
  18. $triangle-size-default: $base-px-default !default;
  19. $triangle-color-default: #222222 !default;
  20. $triangle-element-default: after !default;
  21. // Circle
  22. $circle-size-default: $base-px-default !default;
  23. $circle-color-default: inherit !default;
  24. $circle-border-width-default: null !default;
  25. $circle-border-color-default: #222222 !default;
  26. $circle-display-default: inline-block !default;
  27. // Position
  28. $position-default: null !default;
  29. // Tint/Shade
  30. $mix-percent-default: 15% !default;
  31.  
  32.  
  33. // ----------------------------------
  34. // Mixins
  35. // ----------------------------------
  36.  
  37. // Breakpoints
  38. // -----------
  39. $breakpoints: (
  40. "xxlarge": (min-width: 120.0625em), // >= 1921px
  41. "xlarge-only": (min-width: 90.0625em) and (max-width: 120em), // 1441px - 1920px
  42. "xlarge-up": (min-width: 90.0625em), // <= 1920px
  43. "xlarge": (max-width: 120em), // <= 1920px
  44. "large-only": (min-width: 64.0625em) and (max-width: 90em), // 1025px - 1440px
  45. "large-up": (min-width: 64.0625em), // <= 1440px
  46. "large": (max-width: 90em), // <= 1440px
  47. "medium-only": (min-width: 40.0625em) and (max-width: 64em), // 641px - 1024px
  48. "medium-up": (min-width: 40.0625em), // <= 1024px
  49. "medium": (max-width: 64em), // <= 1024px
  50. "not-small": (min-width: 40.0625em), // >= 641px
  51. "small": (max-width: 40em), // <= 640px
  52. "xsmall": (max-width: 30em), // <= 480px
  53. "xxsmall": (max-width: 20em), // <= 320px
  54. "iphone3": (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 1),
  55. "iphone3-landscape": (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 1) and (orientation: landscape),
  56. "iphone3-portrait": (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 1) and (orientation: portrait),
  57. "iphone4": (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3),
  58. "iphone4-landscape": (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3) and (orientation: landscape),
  59. "iphone4-portrait": (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3) and (orientation: portrait),
  60. "iphone5": (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40/71),
  61. "iphone5-landscape": (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40/71) and (orientation: landscape),
  62. "iphone5-portrait": (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40/71) and (orientation: portrait),
  63. "iphone6": (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-device-pixel-ratio: 2),
  64. "iphone6-landscape": (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape),
  65. "iphone6-portrait": (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait),
  66. "iphone6-plus": (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-device-pixel-ratio: 3),
  67. "iphone6-plus-landscape": (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape),
  68. "iphone6-plus-portrait": (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait),
  69. "ipad": (min-device-width: 768px) and (max-device-width: 1024px),
  70. "ipad-landscape": (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape),
  71. "ipad-portrait": (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait),
  72. "ipad-retina": (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 2),
  73. "ipad-retina-landscape": (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape),
  74. "ipad-retina-portrait": (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait),
  75. "hdpi": "(-webkit-min-device-pixel-ratio: $hdpi-ratio-default),
  76. only screen and (min--moz-device-pixel-ratio: $hdpi-ratio-default),
  77. only screen and (-moz-min-device-pixel-ratio: $hdpi-ratio-default),
  78. only screen and (-o-min-device-pixel-ratio: #{$hdpi-ratio-default}/1),
  79. only screen and (min-resolution: #{round($hdpi-ratio-default*96)}dpi),
  80. only screen and (min-resolution: #{$hdpi-ratio-default}dppx)"
  81. );
  82. @mixin bp($break, $viewport1: null) {
  83. // preset breakpoint
  84. @if not $viewport1 {
  85. @if map-has-key($breakpoints, $break) {
  86. @media only screen and #{inspect(map-get($breakpoints, $break))} { @content; }
  87. }
  88. @else {
  89. @warn "Couldn't find a breakpoint named #{$break}.";
  90. }
  91. }
  92. @else {
  93. // min breakpoint
  94. @if $break == min {
  95. @media screen and (min-width: $viewport1) { @content; }
  96. }
  97. // max breakpoint
  98. @else if $break == max {
  99. @media screen and (max-width: $viewport1) { @content; }
  100. }
  101. // min & max breakpoint
  102. @else {
  103. @media screen and (min-width: $break) and (max-width: $viewport1) { @content; }
  104. }
  105. }
  106. }
  107.  
  108.  
  109. // Single side border radius
  110. // -------------------------
  111. @mixin border-top-radius($radius: $border-radius-default) {
  112. border-top-right-radius: $radius;
  113. border-top-left-radius: $radius;
  114. }
  115. @mixin border-right-radius($radius: $border-radius-default) {
  116. border-top-right-radius: $radius;
  117. border-bottom-right-radius: $radius;
  118. }
  119. @mixin border-bottom-radius($radius: $border-radius-default) {
  120. border-bottom-right-radius: $radius;
  121. border-bottom-left-radius: $radius;
  122. }
  123. @mixin border-left-radius($radius: $border-radius-default) {
  124. border-top-left-radius: $radius;
  125. border-bottom-left-radius: $radius;
  126. }
  127.  
  128.  
  129. // Transforms
  130. // ----------
  131. @mixin transform-single($property, $value) {
  132. transform: #{$property}unquote('('#{$value}')');
  133. }
  134. @mixin rotate($deg) {
  135. @include transform-single(rotate, $deg);
  136. }
  137. @mixin rotateX($deg) {
  138. @include transform-single(rotateX, $deg);
  139. }
  140. @mixin rotateY($deg) {
  141. @include transform-single(rotateY, $deg);
  142. }
  143. @mixin rotateZ($deg) {
  144. @include transform-single(rotateZ, $deg);
  145. }
  146. @mixin rotate3d($x, $y, $z, $deg) {
  147. $multi-var: $x, $y, $z, $deg;
  148. @include transform-single(rotate3d, $multi-var);
  149. }
  150. @mixin scale($ratio) {
  151. @include transform-single(scale, $ratio);
  152. }
  153. @mixin scaleX($ratio) {
  154. @include transform-single(scaleX, $ratio);
  155. }
  156. @mixin scaleY($ratio) {
  157. @include transform-single(scaleY, $ratio);
  158. }
  159. @mixin scaleZ($ratio) {
  160. @include transform-single(scaleZ, $ratio);
  161. }
  162. @mixin scale3d($x, $y, $z) {
  163. $multi-var: $x, $y, $z;
  164. @include transform-single(scale3d, $multi-var);
  165. }
  166. @mixin skew($x, $y) {
  167. $multi-var: $x, $y;
  168. @include transform-single(skew, $multi-var);
  169. backface-visibility: hidden;
  170. }
  171. @mixin skewX($deg) {
  172. @include transform-single(skewX, $deg);
  173. backface-visibility: hidden;
  174. }
  175. @mixin skewY($deg) {
  176. @include transform-single(skewY, $deg);
  177. backface-visibility: hidden;
  178. }
  179. @mixin translate($x, $y) {
  180. $multi-var: $x, $y;
  181. @include transform-single(translate, $multi-var);
  182. }
  183. @mixin translateX($x) {
  184. @include transform-single(translateX, $x);
  185. }
  186. @mixin translateY($y) {
  187. @include transform-single(translateY, $y);
  188. }
  189. @mixin translateZ($z) {
  190. @include transform-single(translateZ, $z);
  191. }
  192. @mixin translate3d($x, $y, $z) {
  193. $multi-var: $x, $y, $z;
  194. @include transform-single(translate3d, $multi-var);
  195. }
  196.  
  197.  
  198. // Emboss effect
  199. // -------------
  200. @mixin box-emboss($opacity, $opacity2){
  201. box-shadow: rgba(white,$opacity) 0 1px 0, inset rgba(black,$opacity2) 0 1px 0;
  202. }
  203.  
  204. // Letterpress effect
  205. // ------------------
  206. @mixin letterpress($opacity){
  207. text-shadow: rgba(white,$opacity) 0 1px 0;
  208. }
  209.  
  210. // Placeholder text
  211. // ----------------
  212. @mixin placeholder-color($color: $placeholder-color-default) {
  213. &::placeholder {
  214. color: $color;
  215. }
  216. }
  217.  
  218. // Sizing
  219. // ------
  220. @mixin size($width, $height: $width) {
  221. width: $width;
  222. height: $height;
  223. }
  224. @mixin square($size) {
  225. @include size($size, $size);
  226. }
  227.  
  228. // Normal & hover state
  229. // --------------------
  230. @mixin hoverer($property, $normal, $hovered) {
  231. #{$property}: $normal;
  232. &:hover {
  233. #{$property}: $hovered;
  234. }
  235. }
  236.  
  237. // Add responsive styling for multiple breakpoints
  238. // -----------------------------------------------
  239. @mixin responsive($property, $full, $medium:false, $small:false) {
  240. #{$property}: $full;
  241. @if $medium {
  242. @include bp(medium) {
  243. #{$property}: $medium;
  244. }
  245. }
  246. @if $small {
  247. @include bp(small) {
  248. #{$property}: $small;
  249. }
  250. }
  251. }
  252.  
  253. // Create a triangle using borders (add in the option to make a border and triangle shape)
  254. // Cut down on the code (Use sass maps for "trbl" and translate direction, maybe direction and border direction)
  255. // ------------------------------------------------------------------------------------------------------------------
  256. @mixin triangle($direction: $triangle-direction-default,
  257. $size: $triangle-size-default,
  258. $color: $triangle-color-default,
  259. $center: false,
  260. $element: $triangle-element-default) {
  261. &:#{$element} {
  262. @if not $center {
  263. position: absolute;
  264. }
  265. content:'';
  266. @include square(0);
  267. -webkit-transform: rotate(360deg);
  268. border-style: solid;
  269. @if $direction == up {
  270. border-width: 0 $size ($size*1.625) $size;
  271. border-color: transparent transparent $color transparent;
  272. @if $center {
  273. @include absolute(null,null,100%,50%);
  274. transform: translateX(-$size);
  275. }
  276. }
  277. @else if $direction == up-right {
  278. border-width: 0 $size $size 0;
  279. border-color: transparent $color transparent transparent;
  280. @if $center {
  281. @include absolute(0,0);
  282. }
  283. }
  284. @else if $direction == right {
  285. border-width: $size 0 $size ($size*1.625);
  286. border-color: transparent transparent transparent $color;
  287. @if $center {
  288. @include absolute(50%,null,null,100%);
  289. transform: translateY(-$size);
  290. }
  291. }
  292. @else if $direction == down-right {
  293. border-width: 0 0 $size $size;
  294. border-color: transparent transparent $color transparent;
  295. @if $center {
  296. @include absolute(null,0,0);
  297. }
  298. }
  299. @else if $direction == down {
  300. border-width: ($size*1.625) $size 0 $size;
  301. border-color: $color transparent transparent transparent;
  302. @if $center {
  303. @include absolute(100%,null,null,50%);
  304. transform: translateX(-$size);
  305. }
  306. }
  307. @else if $direction == down-left {
  308. border-width: $size 0 0 $size;
  309. border-color: transparent transparent transparent $color;
  310. @if $center {
  311. @include absolute(null,null,0,0);
  312. }
  313. }
  314. @else if $direction == left {
  315. border-width: $size ($size*1.625) $size 0;
  316. border-color: transparent $color transparent transparent;
  317. @if $center {
  318. @include absolute(50%,100%);
  319. transform: translateY(-$size);
  320. }
  321. }
  322. @else if $direction == up-left {
  323. border-width: $size $size 0 0;
  324. border-color: $color transparent transparent transparent;
  325. @if $center {
  326. @include absolute(0,null,null,0);
  327. }
  328. }
  329. @else {
  330. @warn "Available directions: up, up-right, right, down-right, down, down-left, left, up-left.";
  331. }
  332. @content;
  333. }
  334. }
  335.  
  336. // Create a circle, with an optional border
  337. @mixin circle($size: $circle-size-default,
  338. $color: $circle-color-default,
  339. $border-width: $circle-border-width-default,
  340. $border-color: $circle-border-color-default,
  341. $display: $circle-display-default) {
  342. display: $display;
  343. border-radius: 50%;
  344. @if $border-width {
  345. @include square($size);
  346. background-color: $color;
  347. border: $border-width solid $border-color;
  348. }
  349. @else{
  350. @if $color == inherit {
  351. border-width: $size/2;
  352. border-style: solid;
  353. @include square(0);
  354. }
  355. @else {
  356. @include square($size);
  357. background-color: $color;
  358. }
  359. }
  360. }
  361.  
  362. // Advanced positioning
  363. // --------------------
  364. @mixin position($type,
  365. $top: $position-default,
  366. $right: $position-default,
  367. $bottom: $position-default,
  368. $left: $position-default) {
  369. position: $type;
  370. $allowed_types: absolute relative fixed;
  371. @if not index($allowed_types, $type) {
  372. @warn "Unknown position: #{$type}.";
  373. }
  374. @each $data in top $top, right $right, bottom $bottom, left $left {
  375. #{nth($data, 1)}: nth($data, 2);
  376. }
  377. }
  378. @mixin absolute($top: $position-default, $right: $position-default, $bottom: $position-default, $left: $position-default) {
  379. @include position(absolute, $top, $right, $bottom, $left);
  380. }
  381. @mixin relative($top: $position-default, $right: $position-default, $bottom: $position-default, $left: $position-default) {
  382. @include position(relative, $top, $right, $bottom, $left);
  383. }
  384. @mixin fixed($top: $position-default, $right: $position-default, $bottom: $position-default, $left: $position-default) {
  385. @include position(fixed, $top, $right, $bottom, $left);
  386. }
  387.  
  388.  
  389. // ----------------------------------
  390. // Placeholders
  391. // ----------------------------------
  392.  
  393. // Clearfix
  394. // --------
  395. %clearfix {
  396. *zoom: 1;
  397. &:before,
  398. &:after {
  399. display: table;
  400. content:'';
  401. line-height: 0;
  402. }
  403. &:after {
  404. clear: both;
  405. }
  406. }
  407.  
  408. // Hide text
  409. // ---------
  410. %hide-text {
  411. font: 0/0 a;
  412. color: transparent;
  413. text-shadow: none;
  414. }
  415.  
  416. // Center an element vertically and horizontally
  417. // ---------------------------------------------
  418. %centerer {
  419. position: absolute;
  420. top: 50%;
  421. left: 50%;
  422. transform: translate(-50%, -50%);
  423. }
  424.  
  425. // Center an element vertically
  426. // ----------------------------
  427. %vert-centerer {
  428. position: relative;
  429. top: 50%;
  430. transform: translateY(-50%);
  431. }
  432.  
  433. // Cover everything
  434. // ----------------
  435. %coverer {
  436. position: absolute;
  437. top: 0;
  438. left: 0;
  439. width: 100%;
  440. height: 100%;
  441. }
  442.  
  443. // Center a block level element
  444. // ----------------------------
  445. %center-block {
  446. display: block;
  447. margin-left: auto;
  448. margin-right: auto;
  449. }
  450.  
  451.  
  452. // ----------------------------------
  453. // Functions
  454. // ----------------------------------
  455.  
  456. // Mix white with another color
  457. // ----------------------------
  458. @function tint($color, $percent: $mix-percent-default){
  459. @return mix(white, $color, $percent);
  460. }
  461.  
  462. // Mix black with another color
  463. // ----------------------------
  464. @function shade($color, $percent: $mix-percent-default){
  465. @return mix(black, $color, $percent);
  466. }
  467.  
  468. // Strip the units from a value
  469. // ----------------------------
  470. @function strip-units($value) {
  471. @return $value / ($value * 0 + 1);
  472. }
  473.  
  474. // Calculate rems from a px value
  475. // ------------------------------
  476. @function rem-calc($px, $base-val: $base-px-default) {
  477. @if not unitless($px) {
  478. $px: strip-units($px);
  479. }
  480. @if not unitless($base-val) {
  481. $base-val: strip-units($base-val);
  482. }
  483. @return ($px / $base-val) * 1rem;
  484. }
  485.  
  486. // Calculate ems from a px value
  487. // ------------------------------
  488. @function em-calc($px, $base-val: $base-px-default) {
  489. @if not unitless($px) {
  490. $px: strip-units($px);
  491. }
  492. @if not unitless($base-val) {
  493. $base-val: strip-units($base-val);
  494. }
  495. @return ($px / $base-val) * 1em;
  496. }
  497.  
  498. // Create a random color
  499. // ---------------------
  500. @function random-color($min: 0, $max: 255, $alpha: 1) {
  501. @if $min < 0 {
  502. $min: -1;
  503. } @else {
  504. $min: $min - 1;
  505. }
  506. @if $max > 255 {
  507. $max: 256;
  508. } @else {
  509. $max: $max + 1;
  510. }
  511. $red: random($max) + $min;
  512. $green: random($max) + $min;
  513. $blue: random($max) + $min;
  514. @return rgba($red, $green, $blue, $alpha);
  515. }
  516.  
  517. // Reverse a string
  518. // ----------------
  519. @function reverse($string) {
  520. $reversed-string: '';
  521. @for $i from 1 through str-length($string) {
  522. $char: str-slice($string, $i, $i);
  523. $reversed-string: "#{$char}#{$reversed-string}";
  524. }
  525. @return #{$reversed-string};
  526. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement