
    fL                     p   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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*                  ej                  j(                  fe
j,                  _        ej                  j$                  e
j,                  _        ej                  j                  ej                  j.                  ej                  j                  ej                  j0                  ej                  j.                  fe
j2                  _        ej                  j$                  e
j2                  _        d Zd Zd Zd Zy)    )HKEY_CURRENT_USERQueryValueExOpenKeyNc                  t    ddd} 	 t        t        d      }t        |d      d   }| |   S # t        $ r Y yw xY w)zD Uses the Windows Registry to detect if the user is using Dark Mode DarkLight)r      z<Software\Microsoft\Windows\CurrentVersion\Themes\PersonalizeAppsUseLightThemer   N)getKeyhkeygetSubkeyValueFileNotFoundError)valueMeaningkeysubkeys      r/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/darkdetect/_windows_detect.pythemer   :   sU     '*LT^_  %89!<   s   + 	77c                  2    t               t               dk(  S y )Nr   r        r   isDarkr   I   s    ww&   r   c                  2    t               t               dk(  S y )Nr   r   r   r   r   isLightr   M   s    ww'!! r   c                 ,   t         j                  j                         }t        j	                  t         j                  j                  d      t         j                  j                  d      t         j                  j                         t         j                  j                  d      t        j                  |             t         j                  j                  t        j                  t         j                  j                              }t         j                  j                         }t         j                  j                         }t        j                  |t         j                  j                  d      t         j                  j                         t         j                  j                         t        j                  t        j                  |      t         j                  j                        t        j                  |             	 t        j                  |t         j                  j                  d      t         j                  j                  d      t         j                  j                  d       t         j                  j                  d             t        j                  |t         j                  j                  d      t         j                  j                         t         j                  j                         t        j                  t        j                  |      t         j                  j                        t        j                  |             |j                   |j                   k7  r'|j                   |_         | |j                   rdnd	       )
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)callbackhKeydwSizequeryValueLast
queryValues        r   listenerr3   R   s?   ??!DZ(cdj)T __""6==1F1F#GHF__**,N&&(J34!!FLL0&//2H2HIV ((OO  &OO!!*-OO""4(OO  '	
 	!!OO""#78OO##%OO##%KKZ0&//2H2HILL 	
 :#3#33#-#3#3N 
 0 0Wf=% r   )winregr   r   r   r   r   r   r   ctypes.wintypeswindllr    r   r   r"   r#   POINTERr!   argtypesLONGrestyper'   r)   r&   r+   r,   r*   r   r   r   r3   r   r   r   <module>r;      s   _ _  ==!! OO
OO
OO
OOFNN6??''(#    "(!5!5    OO
OO
OO
OO
OO
OO&   " %+OO$8$8   ! OO
OO
OO
OO
OO-     ) ,2??+?+?     ( !"
(>r   