Ifeanyi commited on
Commit
4f329a5
·
verified ·
1 Parent(s): 5931c25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -33
app.py CHANGED
@@ -27,60 +27,82 @@ def arithmetic(num1, num2, operation):
27
  return res[0]
28
 
29
  custom_css = """
30
- /* Set the overall background to a dark color */
31
- .gradio-container {
32
- background-color: #121212;
33
- color: #ffffff;
 
 
 
 
34
  }
35
 
36
- /* Style the title and description text */
37
- .gradio-container h1, .gradio-container h2, .gradio-container p {
38
- color: #ffffff;
 
 
 
 
 
 
 
39
  }
40
 
41
- /* Style the input fields with a dark background and blue border */
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  input, textarea {
43
- background-color: #1e1e1e;
44
- border: 2px solid #2a5298;
45
- color: #ffffff;
46
  padding: 10px;
47
  border-radius: 5px;
48
  width: 100%;
49
  box-sizing: border-box;
50
  }
51
 
52
- /* Change border color on focus */
53
- input:focus, textarea:focus {
54
- border-color: #1e3c72;
55
- outline: none;
 
 
56
  }
57
 
58
- /* Style the buttons with a gradient blue background */
59
  button {
60
- background: linear-gradient(to right, #1e3c72, #2a5298);
61
- color: #ffffff;
62
  border: none;
63
  padding: 10px 20px;
64
  border-radius: 5px;
65
  cursor: pointer;
66
- transition: background 0.3s ease;
67
  }
68
 
69
- /* Change button background on hover */
70
- button:hover {
71
- background: linear-gradient(to right, #2a5298, #1e3c72);
 
 
 
 
 
72
  }
73
-
74
- /* Style the labels */
75
- label {
76
- color: #ffffff;
77
- font-weight: bold;
78
- margin-top: 10px;
79
- display: block;
80
- }
81
-
82
- /* Hide footer display */
83
- footer {display: none !important;}
84
  """
85
  with gr.Blocks(
86
  title="R-Powered Calculator",
 
27
  return res[0]
28
 
29
  custom_css = """
30
+ /* Define color variables for light mode */
31
+ :root {
32
+ --background-color-light: #ffffff;
33
+ --text-color-light: #000000;
34
+ --input-background-light: #f0f0f0;
35
+ --input-text-light: #000000;
36
+ --button-background-light: #4CAF50;
37
+ --button-text-light: #ffffff;
38
  }
39
 
40
+ /* Define color variables for dark mode */
41
+ @media (prefers-color-scheme: dark) {
42
+ :root {
43
+ --background-color-dark: #121212;
44
+ --text-color-dark: #ffffff;
45
+ --input-background-dark: #1e1e1e;
46
+ --input-text-dark: #ffffff;
47
+ --button-background-dark: #2a5298;
48
+ --button-text-dark: #ffffff;
49
+ }
50
  }
51
 
52
+ /* Apply background and text colors based on the current mode */
53
+ body {
54
+ background-color: var(--background-color-light);
55
+ color: var(--text-color-light);
56
+ }
57
+
58
+ @media (prefers-color-scheme: dark) {
59
+ body {
60
+ background-color: var(--background-color-dark);
61
+ color: var(--text-color-dark);
62
+ }
63
+ }
64
+
65
+ /* Style the input fields */
66
  input, textarea {
67
+ background-color: var(--input-background-light);
68
+ color: var(--input-text-light);
69
+ border: 1px solid #ccc;
70
  padding: 10px;
71
  border-radius: 5px;
72
  width: 100%;
73
  box-sizing: border-box;
74
  }
75
 
76
+ @media (prefers-color-scheme: dark) {
77
+ input, textarea {
78
+ background-color: var(--input-background-dark);
79
+ color: var(--input-text-dark);
80
+ border: 1px solid #444;
81
+ }
82
  }
83
 
84
+ /* Style the buttons */
85
  button {
86
+ background-color: var(--button-background-light);
87
+ color: var(--button-text-light);
88
  border: none;
89
  padding: 10px 20px;
90
  border-radius: 5px;
91
  cursor: pointer;
92
+ transition: background-color 0.3s ease;
93
  }
94
 
95
+ @media (prefers-color-scheme: dark) {
96
+ button {
97
+ background-color: var(--button-background-dark);
98
+ color: var(--button-text-dark);
99
+ }
100
+ button:hover {
101
+ background-color: #1e3c72;
102
+ }
103
  }
104
+ /* Hide footer display */
105
+ footer {display: none !important;}
 
 
 
 
 
 
 
 
 
106
  """
107
  with gr.Blocks(
108
  title="R-Powered Calculator",