Ashhar commited on
Commit
4fdfb24
1 Parent(s): b59ec81

more fonts

Browse files
Files changed (1) hide show
  1. utils.py +39 -16
utils.py CHANGED
@@ -2,26 +2,59 @@ import streamlit as st
2
  import datetime as DT
3
  import pytz
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  def applyCommonStyles():
7
  st.markdown(
8
- """
9
  <head>
10
- <link href="https://fonts.googleapis.com/css2?family=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&family=Raleway:ital,wght@0,100..900;1,100..900&Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
11
  </head>
12
-
13
  <style>
14
  h1 {
15
  font-family: 'Raleway';
16
  }
17
  .stChatMessage div[data-testid="stMarkdownContainer"], .stChatInput textarea {
18
- font-family: 'Roboto', sans-serif;
19
  }
20
-
21
- .stButton p {
22
  font-size: 0.9rem;
23
  }
24
 
 
 
 
 
25
  @keyframes blinker {
26
  0% {
27
  opacity: 1;
@@ -62,13 +95,3 @@ def applyCommonStyles():
62
  """,
63
  unsafe_allow_html=True
64
  )
65
-
66
-
67
- def __nowInIST() -> DT.datetime:
68
- return DT.datetime.now(pytz.timezone("Asia/Kolkata"))
69
-
70
-
71
- def pprint(log: str):
72
- now = __nowInIST()
73
- now = now.strftime("%Y-%m-%d %H:%M:%S")
74
- print(f"[{now}] [{st.session_state.ipAddress}] {log}")
 
2
  import datetime as DT
3
  import pytz
4
 
5
+ FONTS = [
6
+ # "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",
7
+ # "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",
8
+ "Raleway:ital,wght@0,100..900;1,100..900",
9
+ # "Open+Sans:ital,wght@0,300..800;1,300..800",
10
+ # "Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900",
11
+ # "Nunito:ital,wght@0,200..1000;1,200..1000",
12
+ # "Quicksand:wght@300..700",
13
+ "Montserrat:ital,wght@0,100..900;1,100..900",
14
+ ]
15
+
16
+
17
+ def __nowInIST() -> DT.datetime:
18
+ return DT.datetime.now(pytz.timezone("Asia/Kolkata"))
19
+
20
+
21
+ def pprint(log: str):
22
+ now = __nowInIST()
23
+ now = now.strftime("%Y-%m-%d %H:%M:%S")
24
+ print(f"[{now}] [{st.session_state.ipAddress}] {log}")
25
+
26
+
27
+ def __getFontsUrl():
28
+ baseLink = "https://fonts.googleapis.com/css2"
29
+ params = "&".join([f"family={font}" for font in FONTS])
30
+ params = f"{params}&display=swap"
31
+ fontsUrl = f"{baseLink}?{params}"
32
+ pprint(f"{fontsUrl=}")
33
+ return fontsUrl
34
+
35
 
36
  def applyCommonStyles():
37
  st.markdown(
38
+ f"""
39
  <head>
40
+ <link href="{__getFontsUrl()}" rel="stylesheet">
41
  </head>
42
+ """ """
43
  <style>
44
  h1 {
45
  font-family: 'Raleway';
46
  }
47
  .stChatMessage div[data-testid="stMarkdownContainer"], .stChatInput textarea {
48
+ font-family: 'Montserrat';
49
  }
50
+ .stChatMessage div[data-testid="stMarkdownContainer"] * {
 
51
  font-size: 0.9rem;
52
  }
53
 
54
+ .stChatMessage div[data-testid="stMarkdownContainer"] .stButton p {
55
+ font-size: 0.8rem;
56
+ }
57
+
58
  @keyframes blinker {
59
  0% {
60
  opacity: 1;
 
95
  """,
96
  unsafe_allow_html=True
97
  )