Thank the Lord. How many long suffering nights have I searched for this? Okay, to be honest maybe no more than two but still, I've always wanted to know how to do this.
I suck at MEL scripting or any kind of scripting for that matter. I could use the excuse I just don't have the patience for it but it's probably because I'm too lazy to learn it.
Aaaanyway, here is the MEL script to change the color of a key tick in the timeline in Maya. Wait for it...
keyframe -time `currentTime -q` -tds 1;
That's it. Add it to a shelf. After that just set a key, run the command, and then go to Window > Settings/Preferences > Color Settings, go to the Animation bar and change the Time Slider Tick Special color to whatever you want.
What a time to live.
Since my good friend JP Rhinemiller over at Animators Resource posted a link to this, I've received some requests to demonstrate how to change the color of the key ticks. It's super simple. Hopefully these pics help.
After you have run the script in the Script Editor...
Go to Window> Settings/Preferences> Color Settings (like this)
A new window will pop up. You'll want to click on Animation under the General tab. Look for Time Slider tick special. (like this)
It is set to green by default. Change it to any color you like. Blue starts with 'B' like BREAKDOWN so that's why I chose that color.
As always, I hope this helps!