Jacky Zhao
2022-02-28 e06e341468202eebd928dee6a222ea118ef06331
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
.darkmode {
  float: right;
  padding: 1em;
  min-width: 30px;
  position: relative;
 
  @media all and (max-width: 450px) {
    padding: 1em;
  }
 
  & > .toggle {
    display: none;
    box-sizing: border-box;
  }
 
  & svg {
    opacity: 0;
    position: absolute;
    width: 20px;
    height: 20px;
    top: calc(50% - 10px);
    margin: 0 7px;
    fill: var(--gray);
    transition: opacity 0.1s ease;
  }
}
 
.toggle:checked ~ label {
  & > #dayIcon {
    opacity: 0;
  }
  & > #nightIcon {
    opacity: 1;
  }
}
 
.toggle:not(:checked) ~ label {
  & > #dayIcon {
    opacity: 1;
  }
  & > #nightIcon {
    opacity: 0;
  }
}