LINUX FTW
August 12, 2007Just the other day I was faced with a daunting task. In search of a nice template I found a pretty one which suited my needs just fine. It was free, had nice graphics and looked girlish. Only problem was: it was green. Normally green would be sweet but my instructions were clear: the main color had to be pink.
The graphics were easily transformed and then I was left with a stylesheet of about 800 lines containing various greenish hex-codes. These needed to be replaced by their pinkish counterpart. Let me just say it was not a task I was particularly looking forward too.
Insert Linux. Next to my Windows install I have an Ubuntu install for whenever I feel like playing around with Linux. At work I do a lot of scripting under HP-UX which is a Unix variant. So I was aware of the powerful Unix commands which might be helpful.
I whipped up a pretty regular expression for grep to extract all lines with hex-codes in them. I cleaned all unnecessary and was left with a list of 60 hex-codes. Then I proceded to find all the unique ones and after a while I was left with 20 unique colors.
After some trail and error I managed to get some nice pinkish colors to match the colorscheme I found in the original template. The last step consisted of a global replace of all the old hex-codes with the new ones and overall I’m pretty pleased with the results.
I doubt if I could have done it that fast without the use of the powerfull commandline utilities on Linux.















