Update app.py
Browse files
app.py
CHANGED
|
@@ -12,23 +12,27 @@ def display_full_calendar(year, month):
|
|
| 12 |
# Days of the week headers
|
| 13 |
days_of_week = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
| 14 |
|
| 15 |
-
# Create a formatted HTML table
|
| 16 |
-
table_html = "<table style='border-collapse: collapse; width:
|
| 17 |
|
| 18 |
-
# Add the days of the week as the header row
|
| 19 |
-
table_html += "<tr>"
|
| 20 |
for day in days_of_week:
|
| 21 |
-
table_html += f"<th style='border: 1px solid
|
| 22 |
table_html += "</tr>"
|
| 23 |
|
| 24 |
# Add the weeks to the table
|
| 25 |
for week in month_calendar:
|
| 26 |
table_html += "<tr>"
|
| 27 |
-
for day in week:
|
| 28 |
if day == 0:
|
| 29 |
-
table_html += "<td style='border: 1px solid
|
| 30 |
else:
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
table_html += "</tr>"
|
| 33 |
|
| 34 |
table_html += "</table>"
|
|
@@ -50,4 +54,3 @@ display_full_calendar(year, month)
|
|
| 50 |
if st.checkbox('Show all months for 2025'):
|
| 51 |
for month in range(1, 13):
|
| 52 |
display_full_calendar(year, month)
|
| 53 |
-
|
|
|
|
| 12 |
# Days of the week headers
|
| 13 |
days_of_week = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
| 14 |
|
| 15 |
+
# Create a formatted HTML table with colors
|
| 16 |
+
table_html = "<table style='border-collapse: collapse; width: 80%; margin: 20px auto;'>"
|
| 17 |
|
| 18 |
+
# Add the days of the week as the header row with background color
|
| 19 |
+
table_html += "<tr style='background-color: #f0f0f0;'>"
|
| 20 |
for day in days_of_week:
|
| 21 |
+
table_html += f"<th style='border: 1px solid #ccc; padding: 5px; text-align: center; background-color: #e0e0e0;'>{day}</th>"
|
| 22 |
table_html += "</tr>"
|
| 23 |
|
| 24 |
# Add the weeks to the table
|
| 25 |
for week in month_calendar:
|
| 26 |
table_html += "<tr>"
|
| 27 |
+
for i, day in enumerate(week):
|
| 28 |
if day == 0:
|
| 29 |
+
table_html += "<td style='border: 1px solid #ccc; height: 30px;'></td>" # Empty cell for days not in the month
|
| 30 |
else:
|
| 31 |
+
# Color weekends (Saturday and Sunday)
|
| 32 |
+
if i == 5 or i == 6:
|
| 33 |
+
table_html += f"<td style='border: 1px solid #ccc; height: 30px; text-align: center; background-color: #ffeb3b;'>{day}</td>"
|
| 34 |
+
else:
|
| 35 |
+
table_html += f"<td style='border: 1px solid #ccc; height: 30px; text-align: center; background-color: #ffffff;'>{day}</td>"
|
| 36 |
table_html += "</tr>"
|
| 37 |
|
| 38 |
table_html += "</table>"
|
|
|
|
| 54 |
if st.checkbox('Show all months for 2025'):
|
| 55 |
for month in range(1, 13):
|
| 56 |
display_full_calendar(year, month)
|
|
|