_functions.scss 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. @function theme-color-lighter($color, $background: #fff) {
  2. @return mix($color, $background, 10%);
  3. }
  4. @function theme-color-darker($color) {
  5. @return shade-color($color, 10%);
  6. }
  7. @function str-replace($string, $search, $replace: "") {
  8. $index: str-index($string, $search);
  9. @if $index {
  10. @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
  11. }
  12. @return $string;
  13. }
  14. @mixin media-breakpoint-down-than($name, $breakpoints: $grid-breakpoints) {
  15. $prev: breakpoint-prev($name);
  16. @if $prev == null {
  17. @content;
  18. } @else {
  19. $max: breakpoint-max($prev, $breakpoints);
  20. @if $max {
  21. @media (max-width: $max) {
  22. @content;
  23. }
  24. } @else {
  25. @content;
  26. }
  27. }
  28. }
  29. @function breakpoint-prev($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
  30. $n: index($breakpoint-names, $name);
  31. @if not $n {
  32. @error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
  33. }
  34. @return if($n > 1, nth($breakpoint-names, $n - 1), null);
  35. }