Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Just wondering if I can create a custom shortcut key to change the font color of the notebook text.

I've created a custom shortcut (in dkyeventtransactions.tr) to bring up the font color dialog, as so...

Item[KeyEvent["q", Modifiers -> {Control}],  

but I'm hoping to create different shortcut keys to change the font directly to different colors, without using the font color selection dialog.

share|improve this question
Is this what you are after? –  Kuba May 8 '14 at 17:51
Thanks Kuba, this is very close, but it seems to have the effect of coloring all the characters in the line before the spot that I use it, rather than just change the color for the characters I type next. I your example below, if I were to use the press [Ctrl]-t after typeing dsf, it will change the dsf to red also. –  mitcheljh May 10 '14 at 13:02

1 Answer 1

You have to add the following statement to the KeyEventTranslations.tr file:

Item[KeyEvent["t", Modifiers -> {Control}],
                 FrontEnd`NotebookSelection[ FrontEnd`InputNotebook[]], 
                 FontColor -> RGBColor[1, 0, 0]]]]

enter image description here

Be careful, there is not much "free" letters left and if you use the one that is already used it will not work :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.