mirror of
				https://github.com/ajnart/homarr.git
				synced 2025-11-03 20:15:57 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			794 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			794 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { ActionIcon, Box, useMantineColorScheme } from '@mantine/core';
 | 
						|
import { Sun, MoonStars } from 'tabler-icons-react';
 | 
						|
import { motion } from 'framer-motion';
 | 
						|
 | 
						|
export function ColorSchemeToggle() {
 | 
						|
  const { colorScheme, toggleColorScheme } = useMantineColorScheme();
 | 
						|
 | 
						|
  return (
 | 
						|
    <motion.div
 | 
						|
      whileHover={{ scale: 1.2, rotate: 90 }}
 | 
						|
      whileTap={{
 | 
						|
        scale: 0.8,
 | 
						|
        rotate: -90,
 | 
						|
        borderRadius: '100%',
 | 
						|
      }}
 | 
						|
    >
 | 
						|
      <Box
 | 
						|
        onClick={() => toggleColorScheme()}
 | 
						|
        sx={(theme) => ({
 | 
						|
          cursor: "pointer",
 | 
						|
          color: theme.colorScheme === 'dark' ? theme.colors.yellow[4] : theme.colors.blue[6],
 | 
						|
        })}
 | 
						|
      >
 | 
						|
        {colorScheme === 'dark' ? <Sun size={24} /> : <MoonStars size={24} />}
 | 
						|
      </Box>
 | 
						|
    </motion.div>
 | 
						|
  );
 | 
						|
}
 |