_switches.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**********
  2. * Switch *
  3. **********/
  4. $_switch_bg: if($variant == 'light', transparentize(black, 0.9), lighten($base_color, 10%));
  5. $_switch_slider_bg:$base_color;
  6. switch {
  7. font-size: 1px;
  8. font-weight: bold;
  9. outline-offset: -4px;
  10. transition: all 200ms ease-in;
  11. border: none;
  12. border-radius: 14px;
  13. color: transparent;
  14. padding: 2px;
  15. background-color:$_switch_bg;
  16. box-shadow: inset 0 0 0 1px transparentize(black, 0.95), 0px 1px $bottom_highlight;
  17. &:disabled {
  18. background-color: $insensitive_bg_color;
  19. }
  20. &:backdrop {
  21. background-color: darken($_switch_bg, 7%);
  22. transition: $backdrop_transition;
  23. &:disabled { background-color: $insensitive_bg_color; }
  24. }
  25. &:active,
  26. &:checked {
  27. background-color: $lime;
  28. &:backdrop {
  29. background-color: $lime;
  30. slider {
  31. &:backdrop {
  32. box-shadow:none;
  33. background-color:transparentize($base_color, 0.1);
  34. border:none;
  35. }
  36. }
  37. }
  38. }
  39. // Handle
  40. slider {
  41. padding:2px;
  42. min-width: 16px;
  43. min-height: 16px;
  44. border-radius: 100%;
  45. transition: $button_transition;
  46. background-color: $_switch_slider_bg;
  47. box-shadow: 0 2px 2px transparentize(black, 0.8),
  48. 0 1px 2px transparentize(black, 0.8);
  49. &:backdrop {
  50. padding:2px;
  51. box-shadow:none;
  52. background-color: $base_color;
  53. }
  54. }
  55. &:checked slider { }
  56. &:backdrop {
  57. }
  58. row:selected & {
  59. @if $variant == 'light' {
  60. box-shadow: none;
  61. border-color: $selected_borders_color;
  62. &:backdrop { border-color: $selected_borders_color; }
  63. &.slider:dir(rtl) { border-left-color: $borders_color; }
  64. &.slider:dir(ltr) { border-right-color: $borders_color; }
  65. &.slider { &:checked, & { border-color: $selected_borders_color; } }
  66. }
  67. }
  68. // Trough
  69. trough {
  70. &:active,
  71. &:checked {
  72. background-color: $selected_bg_color;
  73. &:backdrop {
  74. background-color: $backdrop_selected_bg_color;
  75. }
  76. }
  77. }
  78. }