# Create custom shortcut to change font color

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}],
FrontEndExecute[FrontEndToken["FontColorDialog"]]]


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

-
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

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

Item[KeyEvent["t", Modifiers -> {Control}],
FrontEndExecute[
FrontEndSetOptions[
FrontEndNotebookSelection[ FrontEndInputNotebook[]],
FontColor -> RGBColor[1, 0, 0]]]]
`

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

-