aaqibkhan039 commited on
Commit
e7886df
·
verified ·
1 Parent(s): 206d23c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -16
app.py CHANGED
@@ -1,26 +1,48 @@
1
  import streamlit as st
2
 
3
- # Custom CSS for improved aesthetics
4
  st.markdown(
5
  """
6
  <style>
7
- body {
8
- background-color: #f5f5f5;
9
- color: #333;
10
- }
11
  .stApp {
12
- background-color: #ffffff;
 
13
  padding: 20px;
14
  border-radius: 10px;
15
- box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
16
  }
17
- .stSelectbox, .stNumberInput {
18
- font-size: 18px;
 
 
 
 
 
 
 
 
 
 
19
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  .stSuccess {
21
  font-size: 20px;
22
  font-weight: bold;
23
- color: green;
24
  }
25
  </style>
26
  """,
@@ -29,13 +51,12 @@ st.markdown(
29
 
30
  def main():
31
  st.title("📊 Advanced Calculator")
32
- st.write("A simple yet powerful calculator that supports multiple arithmetic operations. Enter your numbers, select an operation, and get instant results!")
33
 
34
- # Sidebar for user input
35
- st.sidebar.header("Input Values")
36
- num1 = st.sidebar.number_input("Enter first number", value=0.0)
37
- num2 = st.sidebar.number_input("Enter second number", value=0.0)
38
- num3 = st.sidebar.number_input("Enter third number", value=0.0)
39
 
40
  # Select operation (Dropdown)
41
  operation = st.selectbox(
 
1
  import streamlit as st
2
 
3
+ # Custom CSS for light/dark mode adaptation
4
  st.markdown(
5
  """
6
  <style>
7
+ /* Make the app container responsive */
 
 
 
8
  .stApp {
9
+ max-width: 600px;
10
+ margin: auto;
11
  padding: 20px;
12
  border-radius: 10px;
13
+ transition: all 0.3s ease-in-out;
14
  }
15
+
16
+ /* Light Mode Styles */
17
+ @media (prefers-color-scheme: light) {
18
+ .stApp {
19
+ background-color: #ffffff;
20
+ color: #333;
21
+ box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
22
+ }
23
+ .stSelectbox, .stNumberInput {
24
+ font-size: 18px;
25
+ color: #000;
26
+ }
27
  }
28
+
29
+ /* Dark Mode Styles */
30
+ @media (prefers-color-scheme: dark) {
31
+ .stApp {
32
+ background-color: #1e1e1e;
33
+ color: #ffffff;
34
+ box-shadow: 2px 2px 10px rgba(255,255,255,0.1);
35
+ }
36
+ .stSelectbox, .stNumberInput {
37
+ font-size: 18px;
38
+ color: #fff;
39
+ }
40
+ }
41
+
42
  .stSuccess {
43
  font-size: 20px;
44
  font-weight: bold;
45
+ color: #4CAF50;
46
  }
47
  </style>
48
  """,
 
51
 
52
  def main():
53
  st.title("📊 Advanced Calculator")
54
+ st.write("A simple yet powerful calculator that adapts to your browser theme. Enter your numbers, select an operation, and get instant results!")
55
 
56
+ # User input for numbers
57
+ num1 = st.number_input("Enter first number", value=0.0)
58
+ num2 = st.number_input("Enter second number", value=0.0)
59
+ num3 = st.number_input("Enter third number", value=0.0)
 
60
 
61
  # Select operation (Dropdown)
62
  operation = st.selectbox(