Vote
Bury
22

Calendar with colored day

Posted in System by dvil88 238 days ago
This is a simple script in php to get a calendar with today's day colored.



PHP script:

http://pastebin.com/f56e5608f

With this you get a calendar starting in Monday or Sunday with today's date in red, to change the color you only have to change '31' (red) in echo chr(27),'[','31m',$color_day,chr(27),'[','0m';

Here you have a complete guide with commands of ANSI/VT100:

http://www.termsys.demon.co.uk/vtansi.htm

The geeklet is configured to execute the script in /var/calendar.php, you can change it to another directory.

Enjoy it!

Geeklet file(s) to download

phpcal.glet

Either right-click and choose "Save Linked File As..." or hold the Option key and click to download files.
If using Safari, you may have to rename the files without the extra .txt extension that is added.

Comments


Written by Manu78C
218 days ago
hello?



Written by fletch
149 days ago
Thanks for the idea. This command is a lot less code, and faster too, since it doesn't need to fire up PHP:

cal | grep --color -C6 -E "(^| )$(date +%e)"

You can use the GREP_COLOR variable to change the default (red) to something else. This is green, for example:

cal | GREP_COLOR="32" grep --color -C6 -E "(^| )$(date +%e)"

Cheers!



Written by jblubey
144 days ago
@Fletch

i tried the two scripts you posted above, and while both of them showed the calendar, on neither was the current date highlighted (nothing was highlighted at all). what am i doing wrong? thanks! (SnowLeo 10.6.3)



Written by kankei71
122 days ago
cal | grep --color -C6 -E "(^| )$(date +%e)"

This works fine in the termainal but doesn't seem to work with geektool as you have to set up a font color. Or am I missing something?



Written by Otaku
105 days ago
how can u add the next month as well?



Written by nBode
66 days ago
So I'm new to this Geek stuff..

When I open the .glet file I just get a blank box.. What am I missing?



Written by wontolla
32 days ago
There seems to be a bug when you change start day to monday, and the first day of the month starts on a sunday (i.e. August 2010): it will print 8 days in the first week of the month.

Setting start day to sunday fixes it.



Log in to comment or register here.