trepan/lib/term_background.py
def is_dark_color_fg_bg():
    """Consult (environment) variables DARK_BG and COLORFGB
    On return, variable is_dark_bg is set"""
    dark_bg = environ.get('DARK_BG', None)
    if dark_bg is not None:
        return dark_bg != '0'
    color_fg_bg = environ.get('COLORFGBG', None)
    if color_fg_bg:
        if color_fg_bg in ('15;0', '15;default;0'):
            return True
        elif color_fg_bg in ('0;15', '0;default;15' ):
            return False
    else:
        return True
    return None
def is_dark_color_fg_bg():
    """Consult (environment) variables DARK_BG and COLORFGB
    On return, variable is_dark_bg is set"""
    dark_bg = environ.get('DARK_BG', None)
    if dark_bg is not None:
        return dark_bg != '0'
    color_fg_bg = environ.get('COLORFGBG', None)
    if color_fg_bg:
        if color_fg_bg in ('15;0', '15;default;0'):
            return True
        elif color_fg_bg in ('0;15', '0;default;15' ):
            return False
    else:
        return True
    return None
Consult (environment) variables DARK_BG and COLORFGB
    On return, variable is_dark_bg is set