Skip to content

Commit 0db4fda

Browse files
committed
Fix: use theme colors, toggle size
1 parent a6a084f commit 0db4fda

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

app/components/Settings/Toggle.client.vue

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,35 @@ input {
5959
justify-self: end;
6060
}
6161
62-
label:has(input:focus) .toggle--background {
63-
outline: solid 2px #030712;
64-
outline-offset: 2px;
65-
}
66-
67-
label:has(input:checked) .toggle--background {
68-
background: #030712;
69-
border-color: #030712;
70-
}
71-
72-
label:has(input:hover) .toggle--background {
73-
background: #6b7280;
74-
}
75-
7662
/* background */
7763
.toggle--background {
78-
width: 46px;
79-
height: 26px;
80-
background: #9ca3af;
64+
width: 44px;
65+
height: 24px;
66+
background: var(--fg-subtle);
8167
border-radius: 9999px;
82-
border: 1px solid #030712;
68+
border: 1px solid var(--fg);
8369
display: flex;
8470
position: relative;
8571
}
8672
87-
.toggle--checkbox:checked.ltr + .toggle--background:before {
88-
transform: translate(21px);
89-
left: 2px;
73+
label:has(input:focus) .toggle--background {
74+
outline: solid 2px var(--fg);
75+
outline-offset: 2px;
9076
}
9177
92-
.toggle--checkbox:checked.rtl + .toggle--background:before {
93-
transform: translate(-21px);
94-
right: 2px;
78+
label:has(input:checked) .toggle--background {
79+
background: var(--fg);
80+
border-color: var(--fg);
81+
}
82+
83+
label:has(input:hover) .toggle--background {
84+
background: var(--fg-muted);
9585
}
9686
9787
/* Circle that moves */
9888
.toggle--checkbox:checked + .toggle--background:before {
9989
animation-fill-mode: forwards;
10090
transition: transform 200ms ease-in-out;
101-
background: #f9fafb;
10291
}
10392
10493
.toggle--background:before {
@@ -107,9 +96,26 @@ label:has(input:hover) .toggle--background {
10796
content: '';
10897
width: 20px;
10998
height: 20px;
110-
top: 2px;
99+
top: 1px;
111100
position: absolute;
112101
border-radius: 9999px;
113-
background: #f9fafb;
102+
background: var(--bg);
103+
}
104+
105+
/* Support rtl locales */
106+
.toggle--checkbox.ltr + .toggle--background:before {
107+
left: 3px;
108+
}
109+
110+
.toggle--checkbox.rtl + .toggle--background:before {
111+
right: 3px;
112+
}
113+
114+
.toggle--checkbox:checked.ltr + .toggle--background:before {
115+
transform: translate(17px);
116+
}
117+
118+
.toggle--checkbox:checked.rtl + .toggle--background:before {
119+
transform: translate(-17px);
114120
}
115121
</style>

0 commit comments

Comments
 (0)