ThemeMaker my first serious project

Little blog post about how I created Thememaker.site opensourced on github.

Little blog post about how I created Thememaker.site the first theme maker for Telegram, which is also opensourced on github.


On 11 January 2017 Telegram launched a new update for his desktop app, and one of the biggest changes was the custom themes support. The second day I created the github repository and on 13 january the version 0.01 was working.


The Idea

I tried to actually create a theme myself but the way it had to be done was slow and hard. you actually have to type the colors of all the 300+ variables in hexadecimal. Nope, it was too much for me.

I’m a lazy person and unless the thing I’m doing is very interesting, like coding, I easily get bored. Then I searched for a easier way. There Wasn’t. That’s how The idea of a theme maker was born.


What I knew and What I didn’t

  • It wasn’t the first time I was trying to work with files creation, previously I’ve tried to mass create a lot of files for a file based quotes site. naturally I didn’t finished it, but that project helped me to understand the hard points of file creation in PHP.
  • I worked with forms and get requests previously, so it was easier to get the data from the PHP posts and elaborate it.
  • I knew almost nothing about user input sanitization, an I discovered it was important for the theme name field. ‘ve been really scared when two days after thememaker.site launch I found theme folders in root folder.
  • I didn’t knew how to create a download page for the files.
  • I didn’t knew hot to zip compress a folder and rename it lately.

The hardest part: theme model

Before starting to really code this project I had a great problem, How o create the theme model? I thought about different things, which can be simplified in two possibilities:

  1. Writing all 500+ colors by hand
  2. Creating it using some kind of program.

I decided to try the second one. (I’m a lazy person remember?) Fortunately Atom.io came to my rescue, thanks to his find and replace function which supports regex! So using some tries on http://regexr.com/ site I successfully transformed a telegram desktop theme into a PHP String containing the PHP array values in the color places here’s some photos to explain it.

That’s the Original Theme which I used to crate the model, and how a theme must have been created before thememaker.
That’s the array I created
That’s the model of the theme with spaces for the variables created from the previous theme
That’s the complete or expert mode model which allows you to change all 300+ colors.

How it works, some technical stuff

To contiue the reading please visit my personal blog http://danielpetrica.pw/home/thememaker-my-first-serious-project you’ll find the technical stuff section, the what i learned section and some statistics about the project.

p.s. please click the 👏icon if you want to show some support.