Skip to content

Instantly share code, notes, and snippets.

@davedarko
Created January 12, 2026 19:50
Show Gist options
  • Select an option

  • Save davedarko/8c8d49212092a4ef9c035bdc8daf280e to your computer and use it in GitHub Desktop.

Select an option

Save davedarko/8c8d49212092a4ef9c035bdc8daf280e to your computer and use it in GitHub Desktop.
from PIL import Image, ImageDraw, ImageFont, ImageColor
from datetime import datetime
import os
import pytz
now = datetime.now()
dt_string = now.strftime("%m-%d %H:%M")
dt_string_2 = now.strftime("%Y%m%d%H%M%S")
now_ca = datetime.now(pytz.timezone('America/Los_Angeles'))
ca_string = now_ca.strftime("%H:%M")
now_ny = datetime.now(pytz.timezone('America/New_York'))
ny_string = now_ny.strftime("%H:%M")
now_cn = datetime.now(pytz.timezone('Asia/Shanghai'))
cn_string = now_cn.strftime("%H:%M")
now_sy = datetime.now(pytz.timezone('Australia/Sydney'))
sy_string = now_sy.strftime("%H:%M")
now_bln = datetime.now(pytz.timezone('Europe/Berlin'))
bln_string = now_bln.strftime("%H:%M")
background_color = (11, 22, 22)
highlight_color = (255, 0, 64)
text_color = ("darkorange")
dates = {
"2026-05-25 23:59:59": "Towel Day",
}
# Define the Unix epoch start date
epoch = datetime(1970, 1, 1)
# Get the current date and time
now = datetime.utcnow()
# Calculate the difference in days
days_since_epoch = (now - epoch).days
# 2560 × 1600
fontsize = 42
font2 = ImageFont.truetype("RobotoMono_Bold.ttf", fontsize)
img = Image.new(mode="RGBA", size=(2560,1600), color=background_color)
draw = ImageDraw.Draw(img)
# top bar
# draw.rectangle((0,0,2560,43), outline='teal', fill=(55, 55, 55))
# Load the JPEG
overlay = Image.open("./bg_tlou.jpg").convert("RGBA")
# Scale the JPEG to fit the canvas or a region
overlay = overlay.resize((2560,1600)) # for example, 800x600
# Paste it onto your base image at position (x, y)
img.paste(overlay, (0, 43), overlay) # use overlay as mask to keep transparency
#
draw.text((100, 100), dt_string, font=font2, fill=text_color)
distance = 290/60*fontsize;
offset = 650/60*fontsize;
draw.text(( offset + 0 * distance, 100), "CA" + ca_string, font=font2, fill=highlight_color)
draw.text(( offset + 1 * distance, 100), "NY" + ny_string, font=font2, fill=highlight_color)
draw.text(( offset + 2 * distance, 100), "CN" + cn_string, font=font2, fill=highlight_color)
draw.text(( offset + 3 * distance, 100), "SY" + sy_string, font=font2, fill=highlight_color)
draw.text(( offset + 4 * distance, 100), "BLN" + bln_string, font=font2, fill=highlight_color)
characters = [
'Ellie',
'Abby',
'Dina',
'Joel',
'Lev',
'Tommy',
'Yara',
'Jesse',
'Manny',
'Mel',
'Marlene',
'Bill',
];
dayTLOU = days_since_epoch%12
cod = characters[dayTLOU]
lc = len(cod)
draw.text((2560 - 300 -lc*36, 1600 -80), cod + " - " + str(days_since_epoch), font=font2, fill=highlight_color)
i = 0
for date in dates :
timestrDate = datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
difference = timestrDate - now
days_difference = str(difference.days)
if difference.days < 0 and difference.days > -10 : days_difference = " " + days_difference
if difference.days >= 0 and difference.days<10 : days_difference = " " + days_difference
if difference.days >= 0 and difference.days <100 : days_difference = " " + days_difference
draw.text((100, 180 + (fontsize * 1.5) * i), str(days_difference) + ': ' + timestrDate.strftime("%b-%d %a") + " | " + str(dates[date]), font=font2, fill=text_color)
i+=1
img.save("/Users/dave/Pictures/Backgrounds/"+dt_string_2 + ".png")
print("/Users/dave/Pictures/Backgrounds/"+dt_string_2 + ".png saved")
@davedarko
Copy link
Author

This generates a background image, that also features a countdown calendar and shows you the current daily challenge character in "The Last Of Us 2" and the custom code for the daily run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment