|
154 | 154 |
|
155 | 155 | /* Tag Cloud Styling */ |
156 | 156 | ul.cloud { |
157 | | - gap: 0.8rem; |
| 157 | + gap: 0.4rem 1rem; |
| 158 | + justify-content: center; |
| 159 | + padding: 1rem 0; |
158 | 160 | } |
159 | 161 |
|
160 | 162 | ul.cloud li { |
161 | | - margin: 0.4rem 0.2rem; |
| 163 | + margin: 0.2rem 0.3rem; |
162 | 164 | } |
163 | 165 |
|
164 | 166 | ul.cloud a { |
165 | | - display: inline-flex; |
166 | | - align-items: center; |
167 | | - justify-content: center; |
168 | | - gap: 0.15rem; |
169 | | - padding: 0.2rem 0.45rem; |
170 | | - background-color: #fff; |
171 | | - border: 2px solid #7cae8c; /* lighter green outline */ |
172 | | - border-radius: 8px; |
173 | | - transition: all 0.25s ease; |
| 167 | + display: inline-block; |
| 168 | + position: relative; |
| 169 | + padding: 0 0.9em 0 0; |
| 170 | + background: none; |
| 171 | + border: none; |
| 172 | + border-radius: 0; |
| 173 | + box-shadow: none; |
| 174 | + color: var(--tag-color) !important; |
174 | 175 | font-weight: 400; |
175 | | - font-size: 0.65rem; |
176 | 176 | text-decoration: none; |
177 | | - position: relative; |
178 | | - color: #105028; |
179 | | - } |
180 | | - |
181 | | - ul.cloud a:hover, |
182 | | - ul.cloud a:focus { |
183 | | - background-color: #105028; |
184 | | - color: #ffffff !important; |
185 | | - border-color: #105028; |
186 | | - text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); |
187 | | - } |
188 | | - |
189 | | - ul.cloud a:hover .badge, |
190 | | - ul.cloud a:focus .badge { |
191 | | - background: rgba(255, 255, 255, 0.3); |
192 | | - border-color: rgba(255, 255, 255, 0.6); |
193 | | - color: #fff; |
| 177 | + cursor: pointer; |
| 178 | + letter-spacing: 0.01em; |
| 179 | + transition: opacity 0.18s ease, transform 0.18s ease; |
| 180 | + white-space: nowrap; |
194 | 181 | } |
195 | 182 |
|
196 | 183 | ul.cloud a::before { |
197 | 184 | content: ""; |
198 | 185 | display: none; |
199 | 186 | } |
200 | 187 |
|
| 188 | + /* link icon right of text */ |
201 | 189 | ul.cloud a::after { |
202 | | - content: ""; |
203 | | - display: none; |
| 190 | + content: "\1F517"; |
| 191 | + display: inline-block; |
| 192 | + position: absolute; |
| 193 | + top: 50%; |
| 194 | + right: 0; |
| 195 | + transform: translateY(-50%); |
| 196 | + font-size: 0.5em; |
| 197 | + line-height: 1; |
| 198 | + opacity: 0.5; |
| 199 | + transition: opacity 0.18s ease; |
| 200 | + } |
| 201 | + |
| 202 | + ul.cloud a:hover, |
| 203 | + ul.cloud a:focus { |
| 204 | + opacity: 0.75; |
| 205 | + transform: translateY(-1px); |
| 206 | + outline: none; |
| 207 | + text-decoration: none; |
| 208 | + } |
| 209 | + |
| 210 | + ul.cloud a:hover::after, |
| 211 | + ul.cloud a:focus::after { |
| 212 | + opacity: 0.9; |
| 213 | + } |
| 214 | + |
| 215 | + ul.cloud a:active { |
| 216 | + transform: translateY(0); |
204 | 217 | } |
205 | 218 |
|
206 | 219 | ul.cloud a .badge { |
207 | | - display: inline-block; |
208 | | - background: linear-gradient(135deg, rgba(96, 120, 96, 0.85), rgba(112, 160, 112, 0.85)); /* darker green */ |
209 | | - color: #fff; |
210 | | - padding: 0.1rem 0.3rem; |
211 | | - border-radius: 6px; |
212 | | - font-size: 0.6em; |
213 | | - font-weight: 600; |
214 | | - margin-left: 0.15rem; |
215 | | - min-width: 1.2em; |
216 | | - text-align: center; |
217 | | - line-height: 1; |
218 | | - vertical-align: middle; |
219 | | - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2); |
| 220 | + display: none; |
220 | 221 | } |
221 | 222 |
|
222 | 223 | @media (prefers-reduced-motion) { |
@@ -4255,41 +4256,56 @@ <h3><a href="https://github.com/frappe/erpnext" target="_blank">ERPNext</a></h3> |
4255 | 4256 |
|
4256 | 4257 | tagCloudContainer.innerHTML = ''; |
4257 | 4258 |
|
4258 | | - const minFontSize = 0.6; |
4259 | | - const maxFontSize = 0.9; |
| 4259 | + const minFontSize = 0.82; |
| 4260 | + const maxFontSize = 1.15; |
4260 | 4261 | const maxCount = Math.max(...Object.values(categoryCounts)); |
4261 | 4262 | const minCount = Math.min(...Object.values(categoryCounts)); |
4262 | 4263 |
|
4263 | | - const getColor = (count) => { |
4264 | | - if (count >= maxCount * 0.8) return '#105028'; // Dark green for highest counts |
4265 | | - if (count >= maxCount * 0.6) return '#156741'; // Medium green for high counts |
4266 | | - if (count >= maxCount * 0.4) return '#1d7d3a'; // Medium-light green for medium counts |
4267 | | - if (count >= maxCount * 0.2) return '#2b8a4d'; // Light green for low counts |
4268 | | - return '#3d9156'; // Lighter green for lowest counts |
4269 | | - }; |
| 4264 | + // Vibrant multi-color palette: [bg, color, border, hover, glow, badgeBg] |
| 4265 | + const palette = [ |
| 4266 | + ['#dbeafe', '#1d4ed8', '#93c5fd', '#1d4ed8', 'rgba(29,78,216,0.30)', 'rgba(29,78,216,0.12)'], // blue |
| 4267 | + ['#dcfce7', '#15803d', '#86efac', '#15803d', 'rgba(21,128,61,0.30)', 'rgba(21,128,61,0.12)'], // green |
| 4268 | + ['#ffedd5', '#c2410c', '#fdba74', '#c2410c', 'rgba(194,65,12,0.30)', 'rgba(194,65,12,0.12)'], // orange |
| 4269 | + ['#ede9fe', '#6d28d9', '#c4b5fd', '#6d28d9', 'rgba(109,40,217,0.30)', 'rgba(109,40,217,0.12)'], // purple |
| 4270 | + ['#ccfbf1', '#0f766e', '#5eead4', '#0f766e', 'rgba(15,118,110,0.30)', 'rgba(15,118,110,0.12)'], // teal |
| 4271 | + ['#fce7f3', '#be185d', '#f9a8d4', '#be185d', 'rgba(190,24,93,0.30)', 'rgba(190,24,93,0.12)'], // pink |
| 4272 | + ['#fef9c3', '#854d0e', '#fde047', '#a16207', 'rgba(161,98,7,0.30)', 'rgba(161,98,7,0.12)'], // amber |
| 4273 | + ['#e0e7ff', '#3730a3', '#a5b4fc', '#3730a3', 'rgba(55,48,163,0.30)', 'rgba(55,48,163,0.12)'], // indigo |
| 4274 | + ['#fee2e2', '#b91c1c', '#fca5a5', '#b91c1c', 'rgba(185,28,28,0.30)', 'rgba(185,28,28,0.12)'], // red |
| 4275 | + ['#f0fdf4', '#166534', '#bbf7d0', '#166534', 'rgba(22,101,52,0.30)', 'rgba(22,101,52,0.12)'], // emerald |
| 4276 | + ['#fff7ed', '#9a3412', '#fed7aa', '#9a3412', 'rgba(154,52,18,0.30)', 'rgba(154,52,18,0.12)'], // burnt |
| 4277 | + ['#f0f9ff', '#0369a1', '#7dd3fc', '#0369a1', 'rgba(3,105,161,0.30)', 'rgba(3,105,161,0.12)'], // sky |
| 4278 | + ]; |
| 4279 | + |
| 4280 | + const hashStr = (s) => [...s].reduce((h, c) => (Math.imul(31, h) + c.charCodeAt(0)) | 0, 0); |
4270 | 4281 |
|
4271 | 4282 | Object.entries(categoryCounts).forEach(([category, count]) => { |
4272 | 4283 | const weight = ((count - minCount) / (maxCount - minCount)) * (maxFontSize - minFontSize) + minFontSize; |
| 4284 | + const [bg, color, border, hover, glow, badgeBg] = palette[Math.abs(hashStr(category)) % palette.length]; |
4273 | 4285 |
|
4274 | | - // Create the list item with a link |
4275 | 4286 | const listItem = document.createElement('li'); |
4276 | 4287 | const link = document.createElement('a'); |
4277 | 4288 | link.href = `#${category}`; |
4278 | | - |
4279 | | - // Create category name with count badge |
| 4289 | + |
| 4290 | + link.style.setProperty('--tag-bg', bg); |
| 4291 | + link.style.setProperty('--tag-color', color); |
| 4292 | + link.style.setProperty('--tag-border', border); |
| 4293 | + link.style.setProperty('--tag-hover', hover); |
| 4294 | + link.style.setProperty('--tag-glow', glow); |
| 4295 | + link.style.setProperty('--tag-shadow', glow); |
| 4296 | + link.style.setProperty('--tag-badge-bg', badgeBg); |
| 4297 | + link.style.fontSize = `${weight}rem`; |
| 4298 | + link.setAttribute('data-weight', count); |
| 4299 | + link.setAttribute('title', `${count} framework(s) in ${category}`); |
| 4300 | + |
4280 | 4301 | const categoryText = document.createElement('span'); |
4281 | 4302 | categoryText.textContent = category; |
4282 | 4303 | link.appendChild(categoryText); |
4283 | | - |
| 4304 | + |
4284 | 4305 | const badge = document.createElement('span'); |
4285 | 4306 | badge.className = 'badge'; |
4286 | 4307 | badge.textContent = count; |
4287 | 4308 | link.appendChild(badge); |
4288 | | - |
4289 | | - link.style.fontSize = `${weight}rem`; |
4290 | | - link.style.color = getColor(count); |
4291 | | - link.setAttribute('data-weight', count); |
4292 | | - link.setAttribute('title', `${count} framework(s) in ${category}`); |
4293 | 4309 |
|
4294 | 4310 | listItem.appendChild(link); |
4295 | 4311 | tagCloudContainer.appendChild(listItem); |
|
0 commit comments