Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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

You have to add the following statement to the file:

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

enter image description here

Be careful: there are not many "free" letters available and when you use one that is already in use, it will not work :)

p.s. a more flexible solution is available with Shortcuts package and joker functionality, just proceed like in: 72914

share|improve this answer

One can change

MenuItem["Red",     FontColor->RGBColor[1, 0, 0]],

to, e. g.,

MenuItem["Red",     FontColor->RGBColor[1, 0, 0], MenuKey["r", Modifiers->{"Control"}]],

in the file.


This has the additional advantage of adding the shortcuts to the menu for easier lookup.


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.