File size: 2,532 Bytes
9a7b472
 
 
 
4fdfb24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a7b472
 
 
4fdfb24
9a7b472
4fdfb24
9a7b472
4fdfb24
9a7b472
 
 
 
b59ec81
4fdfb24
b59ec81
4fdfb24
c972785
 
 
4fdfb24
 
 
 
9a7b472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import streamlit as st
import datetime as DT
import pytz

FONTS = [
    # "Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900",
    # "Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900",
    "Raleway:ital,wght@0,100..900;1,100..900",
    # "Open+Sans:ital,wght@0,300..800;1,300..800",
    # "Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900",
    # "Nunito:ital,wght@0,200..1000;1,200..1000",
    # "Quicksand:wght@300..700",
    "Montserrat:ital,wght@0,100..900;1,100..900",
]


def __nowInIST() -> DT.datetime:
    return DT.datetime.now(pytz.timezone("Asia/Kolkata"))


def pprint(log: str):
    now = __nowInIST()
    now = now.strftime("%Y-%m-%d %H:%M:%S")
    print(f"[{now}] [{st.session_state.ipAddress}] {log}")


def __getFontsUrl():
    baseLink = "https://fonts.googleapis.com/css2"
    params = "&".join([f"family={font}" for font in FONTS])
    params = f"{params}&display=swap"
    fontsUrl = f"{baseLink}?{params}"
    pprint(f"{fontsUrl=}")
    return fontsUrl


def applyCommonStyles():
    st.markdown(
        f"""
        <head>
            <link href="{__getFontsUrl()}" rel="stylesheet">
        </head>
        """ """
        <style>
        h1 {
            font-family: 'Raleway';
        }
        .stChatMessage div[data-testid="stMarkdownContainer"], .stChatInput textarea {
            font-family: 'Montserrat';
        }
        .stChatMessage div[data-testid="stMarkdownContainer"] * {
            font-size: 0.9rem;
        }

        .stChatMessage div[data-testid="stMarkdownContainer"] .stButton p {
            font-size: 0.8rem;
        }

        @keyframes blinker {
            0% {
                opacity: 1;
            }
            50% {
                opacity: 0.2;
            }
            100% {
                opacity: 1;
            }
        }

        .blinking {
            animation: blinker 3s ease-out infinite;
        }

        .code {
            color: green;
            border-radius: 3px;
            padding: 2px 4px; /* Padding around the text */
            font-family: 'Courier New', Courier, monospace; /* Monospace font */
        }

        .large {
            font-size: 15px;
        }

        .bold {
            font-weight: bold;
        }

        div[aria-label="dialog"] {
            width: 80vw;
            height: 620px;
        }

        </style>
        """,
        unsafe_allow_html=True
    )