_custom-forms.scss 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // Mixins: Custom Forms
  3. //
  4. // Custom Switch Variant
  5. @mixin custom-switch-variant($name, $color) {
  6. &.custom-switch-off-#{$name} {
  7. & .custom-control-input ~ .custom-control-label::before {
  8. background: #{$color};
  9. border-color: darken($color, 20%);
  10. }
  11. & .custom-control-input:focus ~ .custom-control-label::before {
  12. box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
  13. }
  14. & .custom-control-input ~ .custom-control-label::after {
  15. background: darken($color, 25%);
  16. }
  17. }
  18. &.custom-switch-on-#{$name} {
  19. & .custom-control-input:checked ~ .custom-control-label::before {
  20. background: #{$color};
  21. border-color: darken($color, 20%);
  22. }
  23. & .custom-control-input:checked:focus ~ .custom-control-label::before {
  24. box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
  25. }
  26. & .custom-control-input:checked ~ .custom-control-label::after {
  27. background: lighten($color, 30%);
  28. }
  29. }
  30. }
  31. // Custom Range Variant
  32. @mixin custom-range-variant($name, $color) {
  33. &.custom-range-#{$name} {
  34. &:focus {
  35. outline: none;
  36. &::-webkit-slider-thumb {
  37. box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
  38. }
  39. &::-moz-range-thumb {
  40. box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
  41. }
  42. &::-ms-thumb {
  43. box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
  44. }
  45. }
  46. &::-webkit-slider-thumb {
  47. background-color: $color;
  48. &:active {
  49. background-color: lighten($color, 35%);
  50. }
  51. }
  52. &::-moz-range-thumb {
  53. background-color: $color;
  54. &:active {
  55. background-color: lighten($color, 35%);
  56. }
  57. }
  58. &::-ms-thumb {
  59. background-color: $color;
  60. &:active {
  61. background-color: lighten($color, 35%);
  62. }
  63. }
  64. }
  65. }