
Switch by GAGalahhad
2.3K
0
#212121
Use with your AI agent
Copy the prompt and paste it into your coding agent.
HTML
<label class="switch"> <input type="checkbox"> <span class="slider"> <span class="circle"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="22" height="22" x="0" y="0" viewBox="0 0 32 32" style="enable-background:new 0 0 512 512" xml:space="preserve" class="sun"> <g> <circle cx="16" cy="16" r="8.312" fill="currentColor" data-original="#000000"></circle> <path d="M31.72 16.706a1.03 1.03 0 0 0 0-1.413l-2.816-3.023a1.037 1.037 0 0 1-.28-.831l.509-4.104c.072-.54-.291-1.05-.832-1.153l-4.062-.78a1.035 1.035 0 0 1-.707-.519l-1.994-3.616a1.037 1.037 0 0 0-1.35-.436l-3.751 1.756c-.27.125-.603.125-.873-.01L11.814.83a1.037 1.037 0 0 0-1.351.436L8.468 4.883c-.146.27-.406.457-.707.52L3.7 6.182c-.54.104-.904.613-.831 1.153l.509 4.104c.03.301-.063.602-.28.831L.28 15.293a1.03 1.03 0 0 0 0 1.413l2.815 3.024c.218.228.312.53.28.831l-.508 4.104c-.073.54.29 1.05.83 1.153l4.063.78c.301.062.561.249.707.519l1.994 3.615c.27.478.863.676 1.351.437l3.75-1.756c.27-.125.603-.125.873.01l3.751 1.746c.488.239 1.08.041 1.35-.437l1.995-3.615c.146-.27.406-.457.707-.52l4.062-.779c.54-.104.904-.613.832-1.153l-.51-4.104a1.037 1.037 0 0 1 .28-.831l2.816-3.023zM16 26.39c-5.725 0-10.39-4.665-10.39-10.39S10.275 5.61 16 5.61 26.39 10.275 26.39 16 21.725 26.39 16 26.39z" fill="currentColor" data-original="#000000"></path> </g> </svg> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 512 512" height="22" width="22" class="moon"> <g clip-path="url(#clip0_68_17)">
CSS
.switch { --total_transition_duration: .3s; --slider_width: 2.875em; --slider_height: 1.5em; --slider_light_bg: linear-gradient(90deg, #f32a85 0%, #f19d36 100%); --slider_night_bg: linear-gradient(90deg, #1701a1 0%, #af0693 75%); --slider_offset: calc((var(--slider_height) - var(--circle_diameter)) / 2); --slider_radius: calc(var(--slider_height) / 2); --circle_diameter: 1.125em;