@mixin switch() {
  switch {
    outline-offset: -4px;
    margin: 4px;
    font-size: smaller;
    font-weight: bold;
    color: gtkalpha($fg_color, 0.9);
    border: 1px solid $borders;
    border-radius: $button_radius + 1;
    background-color: gtkshade($bg_color, 0.9);

    &:checked {
      color: gtkalpha($selected_fg_color, 0.9);
      border-color: gtkshade($borders, 0.5);
      background-color: $selected_bg_color;
      text-shadow: 0 0 2px gtkalpha($light_shadow, 0.6);

      &:backdrop {
        color: gtkalpha($unfocused_selected_fg_color, 0.9);
        border-color: $unfocused_borders;
        background-color: $unfocused_borders;
        text-shadow: none;
      }
    }

    &:disabled {
      color: $disabled_fg_color;
      border-color: $unfocused_borders;
      background-color: $disabled_bg_color;

      &:backdrop {
        color: $unfocused_disabled_fg_color;
        border-color: $unfocused_borders;
        background-color: $unfocused_disabled_bg_color;
      }
    }

    &:backdrop {
      color: $unfocused_fg_color;
      border-color: $unfocused_borders;
      background-color: gtkshade($unfocused_bg_color, 0.9);
    }

    slider {
      min-width: 46px;
      min-height: 27px;
      margin: -1px;
      border-radius: $button_radius;
      color: $fg_color;
      border: 1px solid gtkshade($borders, 0.85);
      background-color: $dark_bg_color;
      background-image: linear-gradient(to bottom, gtkshade($bg_color, 1.05), $bg_color);
      box-shadow: inset 0 1px gtkalpha($light_shadow, 0.1), inset 0 -1px gtkalpha($dark_shadow, 0.1), 0 1px gtkalpha($dark_shadow, 0.1);
    }

    &:checked {
      slider { border: 1px solid gtkshade($borders, 0.5); }

      &:backdrop slider {
        border-color: $unfocused_borders;
        background-image: none;
        box-shadow: none;
      }
    }

    &:disabled {
      slider {
        border-color: $unfocused_borders;
        background-color: $disabled_bg_color;
        background-image: none;
        box-shadow: none;
      }

      &:backdrop slider {
        border-color: $unfocused_borders;
        background-color: $unfocused_disabled_bg_color;
        background-image: none;
        box-shadow: none;
      }
    }

    &:backdrop slider {
      border-color: $unfocused_borders;
      background-color: $unfocused_bg_color;
      background-image: none;
      box-shadow: none;
    }
  }
}
