U
    lhL                     @   s   d dl mZmZmZ d dlZd dlZej	j
Z
ejjejjejjejjeejjfe
j_ejje
j_ejjejjejjejjejjejjfe
j_ejje
j_ejjejjejjejjejjfe
j_ejje
j_dd Zdd Zdd Zd	d
 ZdS )    )HKEY_CURRENT_USERQueryValueExOpenKeyNc                  C   sF   ddd} zt td}t|dd }W n tk
r<   Y dS X | | S )zD Uses the Windows Registry to detect if the user is using Dark Mode DarkLight)r      z<Software\Microsoft\Windows\CurrentVersion\Themes\PersonalizeZAppsUseLightThemer   N)getKeyhkeygetSubkeyValueFileNotFoundError)ZvalueMeaningkeysubkey r   >/tmp/pip-unpacked-wheel-lmp10r8o/darkdetect/_windows_detect.pytheme:   s    

r   c                   C   s   t  d k	rt  dkS d S )Nr   r   r   r   r   r   isDarkI   s    
r   c                   C   s   t  d k	rt  dkS d S )Nr   r   r   r   r   r   isLightM   s    
r   c                 C   sJ  t j }tt jdt jdt j t jdt | t jt t jj}t j }t j }t	|t jdt j
 t j
 t t |t jjt | t|t jdt jdt jd t jd t	|t jdt j
 t j
 t t |t jjt | |j|jkr|j|_| |jr>dnd	 qd S )
Nl       s<   SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalizei  s   AppsUseLightThemeT   Fr   r   )ctypeswintypesHKEYadvapi32RegOpenKeyExALPCSTRDWORDbyrefsizeofRegQueryValueExALPDWORDcastLPBYTERegNotifyChangeKeyValueBOOLHANDLEvalue)callbackZhKeydwSizeZqueryValueLastZ
queryValuer   r   r   listenerR   sJ    












r(   )winregr   r	   r   r
   r   r   r   Zctypes.wintypeswindllr   r   r   r   r   POINTERr   argtypesLONGrestyper   r!   r   r#   r$   r"   r   r   r   r(   r   r   r   r   <module>   s:   

