def get_theme():
theme = None<EOL>log.debug('<STR_LIT>', env.COLORFGBG)<EOL>if env.COLORFGBG:<EOL><INDENT>FG, _, BG = env.COLORFGBG.partition('<STR_LIT:;>')<EOL>theme = '<STR_LIT>' if BG < '<STR_LIT>' else '<STR_LIT>'  <EOL><DEDENT>else:<EOL><INDENT>if os_name == '<STR_LIT>':<EOL><INDENT>from .windows import get_color as _get_color  <EOL>color_id = _get_color('<STR_LIT>')<EOL>theme = '<STR_LIT>' if color_id < <NUM_LIT:8> else '<STR_LIT>'<EOL><DEDENT>elif os_name == '<STR_LIT>':<EOL><INDENT>if env.TERM in ('<STR_LIT>', '<STR_LIT>'):  <EOL><INDENT>theme = '<STR_LIT>'<EOL><DEDENT>elif sys.platform.startswith('<STR_LIT>'):  <EOL><INDENT>theme = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>colors = get_color('<STR_LIT>')  <EOL>if colors:<EOL><INDENT>colors = tuple(int(cm[:<NUM_LIT:2>], <NUM_LIT:16>) for cm in colors)<EOL>avg = sum(colors) / len(colors)<EOL>theme = '<STR_LIT>' if avg < <NUM_LIT> else '<STR_LIT>'<EOL><DEDENT><DEDENT><DEDENT><DEDENT>log.debug('<STR_LIT>', theme)<EOL>return theme<EOL>
Checks system for theme information.

        First checks for the environment variable COLORFGBG.
        Next, queries terminal, supported on Windows and xterm, perhaps others.
        See notes on get_color().

        Returns:
            str, None: 'dark', 'light', None if no information.