_form-colorinput.scss 1.1 KB
Newer Older
1 2 3
/*
Color Input
 */
4
.form-colorinput {
5 6
  position: relative;
  display: inline-block;
C
codecalm 已提交
7
  margin: 0;
8
  line-height: 1;
C
codecalm 已提交
9
  cursor: pointer;
10 11
}

12
.form-colorinput-input {
13 14 15 16 17
  position: absolute;
  z-index: -1;
  opacity: 0;
}

18
.form-colorinput-color {
19 20 21
  display: block;
  width: 1.5rem;
  height: 1.5rem;
C
codecalm 已提交
22
  color: $white;
23
  border: 1px solid $input-border-color-translucent;
24 25 26
  border-radius: 3px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);

C
codecalm 已提交
27
  &:before {
28 29 30 31 32 33 34 35 36
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    content: "";
    background: no-repeat center center/$form-check-input-checked-bg-size;
    background-image: escape-svg($form-check-input-checked-bg-image);
    opacity: 0;
37
    @include transition(opacity $transition-time);
38

39
    .form-colorinput-input:checked ~ & {
40 41 42 43
      opacity: 1;
    }
  }

44
  .form-colorinput-input:focus ~ & {
45
    border-color: var(--#{$prefix}primary);
46 47
    box-shadow: $input-btn-focus-box-shadow;
  }
C
codecalm 已提交
48 49 50 51 52 53

  .form-colorinput-light & {
    &:before {
      background-image: escape-svg($form-check-input-checked-bg-image-dark);
    }
  }
54 55
}