utils.py
def change_code_color(colors, titles, code):
    """
    Function used for code color changing in main home heml page w.r.t user's click events.
    """
    code_list = code.split("\n")

    for idx, line in enumerate(code_list):
        if line.startswith("            "):
            code_list[idx] = f"<p style=\"margin-left: 120px\">{line}</p>"
        elif line.startswith("        "):
            code_list[idx] = f"<p style=\"margin-left: 80px\">{line}</p>"
        elif line.startswith("    "):
            code_list[idx] = f"<p style=\"margin-left: 40px\">{line}</p>"
        elif line=='\r':
            code_list[idx] = f"<p></p>"
        for i, title in enumerate(titles):
            if '__' not in title or title.startswith('__'):
                if title.strip("__") in line:
                    code_list[idx] = f"<font color=\"{colors[i]}\">{code_list[idx]}</font>"
            else:
                # for sep in title.split("__"):
                    # if sep in line and sep:
                if title.split('__')[-2] in line:
                    code_list[idx] = f"{code_list[idx].split(title.split('__')[-2])[0]}<font color=\"{colors[i]}\">{title.split('__')[-2]}</font>{code_list[idx].split(title.split('__')[-2])[-1]}"

        code = "".join(code_list)

    return code

    Function used for code color changing in main home heml page w.r.t user's click events.
    
Function used for code color changing in main home heml page w.r.t user's click events.
Function used for code color changing in main home heml page w . r . t user ' s click events .
def change_code_color(colors, titles, code):
    code_list = code.split("\n")
    for idx, line in enumerate(code_list):
        if line.startswith("            "):
            code_list[idx] = f"<p style=\"margin-left: 120px\">{line}</p>"
        elif line.startswith("        "):
            code_list[idx] = f"<p style=\"margin-left: 80px\">{line}</p>"
        elif line.startswith("    "):
            code_list[idx] = f"<p style=\"margin-left: 40px\">{line}</p>"
        elif line=='\r':
            code_list[idx] = f"<p></p>"
        for i, title in enumerate(titles):
            if '__' not in title or title.startswith('__'):
                if title.strip("__") in line:
                    code_list[idx] = f"<font color=\"{colors[i]}\">{code_list[idx]}</font>"
            else:
                if title.split('__')[-2] in line:
                    code_list[idx] = f"{code_list[idx].split(title.split('__')[-2])[0]}<font color=\"{colors[i]}\">{title.split('__')[-2]}</font>{code_list[idx].split(title.split('__')[-2])[-1]}"
        code = "".join(code_list)
    return code
def change_code_color ( colors , titles , code ) : code_list = code . split ( "\n" ) for idx , line in enumerate ( code_list ) : if line . startswith ( "            " ) : code_list [ idx ] = f"<p style=\"margin-left: 120px\">{line}</p>" elif line . startswith ( "        " ) : code_list [ idx ] = f"<p style=\"margin-left: 80px\">{line}</p>" elif line . startswith ( "    " ) : code_list [ idx ] = f"<p style=\"margin-left: 40px\">{line}</p>" elif line == '\r' : code_list [ idx ] = f"<p></p>" for i , title in enumerate ( titles ) : if '__' not in title or title . startswith ( '__' ) : if title . strip ( "__" ) in line : code_list [ idx ] = f"<font color=\"{colors[i]}\">{code_list[idx]}</font>" else : if title . split ( '__' ) [ - 2 ] in line : code_list [ idx ] = f"{code_list[idx].split(title.split('__')[-2])[0]}<font color=\"{colors[i]}\">{title.split('__')[-2]}</font>{code_list[idx].split(title.split('__')[-2])[-1]}" code = "" . join ( code_list ) return code
Function used for code color changing in main home heml page w.r.t user's click events.
Function used for code color changing in main home heml page w . r . t user ' s click events .
"""
    Function used for code color changing in main home heml page w.r.t user's click events.
    """ # for sep in title.split("__"): # if sep in line and sep:
colors
titles
code