feat: enhance celebration image with decorations and glow effects

This commit is contained in:
Paul Gauthier (aider) 2025-03-26 06:55:04 -10:00
parent ad7c708039
commit 3eff70a3bc

View file

@ -7,6 +7,7 @@ HEIGHT = 675 # Image height
BG_COLOR = "#282a36" # Aider code background color
PRIMARY_COLOR = "#14b014" # Aider terminal green
TEXT_COLOR = "#FFFFFF" # White for contrast
GRID_COLOR = "#3b3d4a" # Slightly lighter than background for grid pattern
FONT_SIZE_LARGE = 110
FONT_SIZE_MEDIUM = 55
FONT_SIZE_SMALL = 30
@ -25,7 +26,7 @@ FONT_FAMILY_MEDIUM = FONT_FAMILY_BOLD
LOGO_PATH = "aider/website/assets/logo.svg"
# --- Text Content ---
line1 = "Thank You!"
line1 = "Thank You to Our Community!"
line2 = "30,000"
line3 = "GitHub Stars"
line4 = "github.com/Aider-AI/aider"
@ -75,26 +76,59 @@ line4_y = (
# --- Generate SVG Content ---
svg_elements = []
# Background
svg_elements.append(f'<rect width="100%" height="100%" fill="{BG_COLOR}"/>')
# Background with pattern
svg_elements.append(f'''<defs>
<pattern id="grid-pattern" width="40" height="40" patternUnits="userSpaceOnUse">
<rect width="40" height="40" fill="{BG_COLOR}"/>
<path d="M 40 0 L 0 0 0 40" stroke="{GRID_COLOR}" stroke-width="0.5" fill="none" opacity="0.3"/>
</pattern>
</defs>''')
svg_elements.append(f'<rect width="100%" height="100%" fill="url(#grid-pattern)"/>')
# Logo
# Terminal-like border
svg_elements.append(f'<rect x="30" y="30" width="{WIDTH-60}" height="{HEIGHT-60}" fill="none" stroke="{PRIMARY_COLOR}" stroke-width="2" rx="8" ry="8"/>')
# Logo with glow
if logo_data_uri:
svg_elements.append(
f'<image href="{logo_data_uri}" x="{logo_x_pos}" y="{logo_y_pos}" '
f'width="{logo_width}" height="{logo_height}" />'
f'width="{logo_width}" height="{logo_height}" filter="url(#logo-glow)" />'
)
# Text Lines
# Adjust font size for longer text
svg_elements.append(
f'<text x="{center_x}" y="{line1_y}" font-family="{FONT_FAMILY_MEDIUM}"'
f' font-size="{FONT_SIZE_MEDIUM}" fill="{TEXT_COLOR}" text-anchor="middle"'
f'<text x="{center_x}" y="{line1_y - 15}" font-family="{FONT_FAMILY_MEDIUM}"'
f' font-size="{FONT_SIZE_MEDIUM - 5}" fill="{TEXT_COLOR}" text-anchor="middle"'
f' dominant-baseline="middle">{line1}</text>'
)
# Add star decorations around the 30,000 number
for i in range(5):
# Left side stars
x_left = center_x - 300 + (i * 50)
y_left = line2_y - 50
size_factor = 0.5 + (i % 3) * 0.15 # Vary sizes
rotation = i * 15 # Different rotations
svg_elements.append(
f'<path d="M 0,0 L 5,-15 L 0,-5 L -5,-15 L 0,0 Z" fill="{PRIMARY_COLOR}" opacity="0.7" '
f'transform="translate({x_left}, {y_left}) scale({size_factor}) rotate({rotation})"/>'
)
# Right side stars
x_right = center_x + 150 + (i * 50)
y_right = line2_y - 45
size_factor = 0.4 + (i % 3) * 0.15 # Vary sizes
rotation = i * 20 # Different rotations
svg_elements.append(
f'<path d="M 0,0 L 5,-15 L 0,-5 L -5,-15 L 0,0 Z" fill="{PRIMARY_COLOR}" opacity="0.7" '
f'transform="translate({x_right}, {y_right}) scale({size_factor}) rotate({rotation})"/>'
)
# Enhanced 30,000 number with improved glow
svg_elements.append(
f'<text x="{center_x}" y="{line2_y}" font-family="{FONT_FAMILY_BOLD}"'
f' font-size="{FONT_SIZE_LARGE}" fill="{PRIMARY_COLOR}" text-anchor="middle"'
f' dominant-baseline="middle" filter="url(#text-glow)">{line2}</text>' # Added glow filter
f' dominant-baseline="middle" filter="url(#number-glow)">{line2}</text>'
)
svg_elements.append(
f'<text x="{center_x}" y="{line3_y}" font-family="{FONT_FAMILY_MEDIUM}"'
@ -113,11 +147,26 @@ svg_content = f"""\
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<!-- Enhanced glow for numbers -->
<filter id="number-glow" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="6 2" result="blur" />
<feColorMatrix in="blur" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.6 0" result="lighter-blur"/>
<feComposite in="SourceGraphic" in2="lighter-blur" operator="over" />
</filter>
<!-- Original glow filter (renamed) -->
<filter id="text-glow" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="4 1" result="blur" />
<feColorMatrix in="blur" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.4 0" result="lighter-blur"/>
<feComposite in="SourceGraphic" in2="lighter-blur" operator="over" />
</filter>
<!-- Logo glow filter -->
<filter id="logo-glow" x="-40%" y="-30%" width="180%" height="160%">
<feGaussianBlur stdDeviation="8 2" result="blur" />
<feColorMatrix in="blur" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.5 0" result="lighter-blur"/>
<feComposite in="SourceGraphic" in2="lighter-blur" operator="over" />
</filter>
</defs>
<style>
/* Define font styles - adjust font family names as needed */