Anne31415 commited on
Commit
aa49850
·
1 Parent(s): 2a3809e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -7
app.py CHANGED
@@ -30,19 +30,21 @@ def cloud_button(label, key=None, color=None):
30
  num_circles = max(3, min(12, len(label) // 4))
31
  circle_size = 60
32
  overlap = 20 # Adjust the overlap value as needed
 
33
 
34
- # Create circles with text enclosed and overlap them
35
  circles_html = ''.join([
36
- f'<div class="circle {color_class}" style="left: {i * overlap}px; top: {i * overlap}px;"></div>'
37
- for i in range(num_circles)
38
  ])
39
- circle_text_style = f'font-size: {circle_size}px; top: {circle_size/2}px; left: {circle_size/2}px; transform: translate(-50%, -50%);'
40
 
41
  cloud_button_html = f"""
42
  <div class="cloud" id="{button_id}" style="margin-bottom: 20px;">
43
  <div class="wrapper {color_class}">
44
- {circles_html}
45
- <div class="circle-text" style="{circle_text_style}">{label}</div>
 
 
46
  </div>
47
  </div>
48
  <style>
@@ -59,16 +61,24 @@ def cloud_button(label, key=None, color=None):
59
  position: relative;
60
  padding: 10px 20px;
61
  }}
 
 
 
 
 
 
62
  .circle {{
63
  background-color: #FF6347;
64
  border-radius: 50%;
65
  width: {circle_size}px;
66
  height: {circle_size}px;
67
  position: absolute;
 
68
  }}
69
  .circle-text {{
70
- position: absolute;
71
  font-weight: bold;
 
72
  z-index: 2;
73
  }}
74
  .color-1 .circle {{ background-color: #FFA07A; }}
 
30
  num_circles = max(3, min(12, len(label) // 4))
31
  circle_size = 60
32
  overlap = 20 # Adjust the overlap value as needed
33
+ text_size = 14 # Adjust the text font size as needed
34
 
35
+ # Create circles with overlap
36
  circles_html = ''.join([
37
+ f'<div class="circle {color_class}" style="margin-left: -{circle_size // 2}px;"></div>'
38
+ for _ in range(num_circles)
39
  ])
 
40
 
41
  cloud_button_html = f"""
42
  <div class="cloud" id="{button_id}" style="margin-bottom: 20px;">
43
  <div class="wrapper {color_class}">
44
+ <div class="circle-container">
45
+ {circles_html}
46
+ </div>
47
+ <div class="circle-text" style="font-size: {text_size}px;">{label}</div>
48
  </div>
49
  </div>
50
  <style>
 
61
  position: relative;
62
  padding: 10px 20px;
63
  }}
64
+ .circle-container {{
65
+ position: relative;
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ }}
70
  .circle {{
71
  background-color: #FF6347;
72
  border-radius: 50%;
73
  width: {circle_size}px;
74
  height: {circle_size}px;
75
  position: absolute;
76
+ z-index: 1;
77
  }}
78
  .circle-text {{
79
+ position: relative;
80
  font-weight: bold;
81
+ text-align: center;
82
  z-index: 2;
83
  }}
84
  .color-1 .circle {{ background-color: #FFA07A; }}