mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
feat: Improve celebration image with glow effect and tighter spacing
This commit is contained in:
parent
75b714a1ad
commit
f993c1f22c
1 changed files with 25 additions and 11 deletions
|
@ -12,10 +12,10 @@ FONT_SIZE_MEDIUM = 55
|
||||||
FONT_SIZE_SMALL = 30
|
FONT_SIZE_SMALL = 30
|
||||||
OUTPUT_FILENAME = "aider_30k_stars_celebration.svg"
|
OUTPUT_FILENAME = "aider_30k_stars_celebration.svg"
|
||||||
|
|
||||||
# Font families - SVG will try these in order. Ensure viewers have suitable fonts.
|
# Font families - SVG will try these in order. Prioritize Inter, then fall back.
|
||||||
FONT_FAMILY_BOLD = "'DejaVu Sans Bold', 'Arial Bold', 'Helvetica Bold', sans-serif-bold, sans-serif"
|
FONT_FAMILY_BOLD = "'Inter Bold', 'DejaVu Sans Bold', 'Arial Bold', 'Helvetica Bold', sans-serif-bold, sans-serif"
|
||||||
FONT_FAMILY_REGULAR = "'DejaVu Sans', 'Arial', 'Helvetica', sans-serif"
|
FONT_FAMILY_REGULAR = "'Inter', 'DejaVu Sans', 'Arial', 'Helvetica', sans-serif"
|
||||||
# Use Bold for Medium as per original Pillow logic attempt
|
# Use Bold for Medium for consistency and visual weight
|
||||||
FONT_FAMILY_MEDIUM = FONT_FAMILY_BOLD
|
FONT_FAMILY_MEDIUM = FONT_FAMILY_BOLD
|
||||||
|
|
||||||
# --- Paths (Adjust if needed) ---
|
# --- Paths (Adjust if needed) ---
|
||||||
|
@ -51,18 +51,20 @@ logo_y_pos = HEIGHT * 0.15
|
||||||
logo_x_pos = center_x - (logo_width / 2)
|
logo_x_pos = center_x - (logo_width / 2)
|
||||||
|
|
||||||
# Adjust text start based on whether logo is present
|
# Adjust text start based on whether logo is present
|
||||||
text_start_y = logo_y_pos + logo_height + 40 if logo_data_uri else HEIGHT * 0.2
|
text_start_y = logo_y_pos + logo_height + 30 if logo_data_uri else HEIGHT * 0.2 # Slightly reduced gap
|
||||||
|
|
||||||
current_y = text_start_y
|
current_y = text_start_y
|
||||||
|
|
||||||
# Calculate Y positions for each line (using dominant-baseline="middle" for vertical centering)
|
# Calculate Y positions for each line (using dominant-baseline="middle" for vertical centering)
|
||||||
line1_y = current_y + FONT_SIZE_MEDIUM / 2
|
line1_y = current_y + FONT_SIZE_MEDIUM / 2
|
||||||
current_y += FONT_SIZE_MEDIUM + 30
|
current_y += FONT_SIZE_MEDIUM + 25 # Reduced gap
|
||||||
line2_y = current_y + FONT_SIZE_LARGE / 2
|
line2_y = current_y + FONT_SIZE_LARGE / 2
|
||||||
current_y += FONT_SIZE_LARGE + 15
|
current_y += FONT_SIZE_LARGE + 10 # Reduced gap
|
||||||
line3_y = current_y + FONT_SIZE_MEDIUM / 2
|
line3_y = current_y + FONT_SIZE_MEDIUM / 2
|
||||||
current_y += FONT_SIZE_MEDIUM + 60
|
# Removed large gap calculation here, line4_y is positioned from bottom
|
||||||
line4_y = HEIGHT - FONT_SIZE_SMALL - 30 + FONT_SIZE_SMALL / 2 # Position near bottom
|
|
||||||
|
# Position line 4 relative to the bottom edge
|
||||||
|
line4_y = HEIGHT - FONT_SIZE_SMALL - 25 + FONT_SIZE_SMALL / 2 # Position near bottom, slightly higher
|
||||||
|
|
||||||
# --- Generate SVG Content ---
|
# --- Generate SVG Content ---
|
||||||
svg_elements = []
|
svg_elements = []
|
||||||
|
@ -86,7 +88,7 @@ svg_elements.append(
|
||||||
svg_elements.append(
|
svg_elements.append(
|
||||||
f'<text x="{center_x}" y="{line2_y}" font-family="{FONT_FAMILY_BOLD}"'
|
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' font-size="{FONT_SIZE_LARGE}" fill="{PRIMARY_COLOR}" text-anchor="middle"'
|
||||||
f' dominant-baseline="middle">{line2}</text>'
|
f' dominant-baseline="middle" filter="url(#text-glow)">{line2}</text>' # Added glow filter
|
||||||
)
|
)
|
||||||
svg_elements.append(
|
svg_elements.append(
|
||||||
f'<text x="{center_x}" y="{line3_y}" font-family="{FONT_FAMILY_MEDIUM}"'
|
f'<text x="{center_x}" y="{line3_y}" font-family="{FONT_FAMILY_MEDIUM}"'
|
||||||
|
@ -104,10 +106,22 @@ svg_content = f"""\
|
||||||
<svg width="{WIDTH}" height="{HEIGHT}" viewBox="0 0 {WIDTH} {HEIGHT}"
|
<svg width="{WIDTH}" height="{HEIGHT}" viewBox="0 0 {WIDTH} {HEIGHT}"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<defs>
|
||||||
|
<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>
|
||||||
|
</defs>
|
||||||
<style>
|
<style>
|
||||||
/* Define font styles - adjust font family names as needed */
|
/* Define font styles - adjust font family names as needed */
|
||||||
@font-face {{
|
@font-face {{
|
||||||
font-family: 'DejaVu Sans Bold'; /* Example */
|
font-family: 'Inter Bold'; /* Example */
|
||||||
|
/* Add src url() if using web fonts, e.g.: */
|
||||||
|
/* src: url(...) format(...); */
|
||||||
|
}}
|
||||||
|
@font-face {{
|
||||||
|
font-family: 'Inter'; /* Example */
|
||||||
/* Add src url() if using web fonts, e.g.: */
|
/* Add src url() if using web fonts, e.g.: */
|
||||||
/* src: url(...) format(...); */
|
/* src: url(...) format(...); */
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue