Series: Love Letter
Phần: 1 / 2- Love Letter - Part 1: A Personalized Love Letter Generator
- Love Letter - Part 2: From Couples' Love Letters to Letters for Any Occasion
Unlike the math modeling posts you usually see on this blog, this one is a small gift: a tool that turns a few lines of your feelings into a beautiful-looking letter.

Why I made this
My feelings usually aren't easy to say out loud, but writing them down, with some preparation, is a different story. Still, a plain text message felt too ordinary, so I chose to write a letter instead. The problem was, after years of studying and working while just typing code, my handwriting has gotten really bad - and bad handwriting pretty much cuts a letter's value in half 😂.
So I built this project to fix that: just prepare the content, and the
project outputs a single .html file - send it through any chat app, and
the recipient just needs to tap it to view it right away. It can also be
customized by theme, to make the "letter" feel even more special.
11 "moods" to choose from
The project ships with 11 templates, each with its own color palette and mood. The letter's content stays the same - just switch templates to get a completely different vibe.
Try them out below:
There are 11 templates for now, and I'll add more in the future (maybe 😊).
How to use it
Get Python ready, install the jinja2 and pyyaml libraries, write your
letter's content into a YAML file (e.g. input.yaml), then run
python generate.py --content input.yaml --output output.htmlThe script will ask you to pick a template, then output a single .html
file - send that file to the recipient and you're done.
Code available at Tung-hehe/love-letter
Closing thoughts
Honestly, I still think a handwritten letter is more sincere, and I'd choose that if I could. But if you have handwriting problems like mine, this is not a bad product.
Happy coding, and may your feelings be fully received through every letter!
