# How can I change the highlighting color of an InlineMathCell?

When using the InlineMathCell one types Ctrl+9 within the text cell, and gets a slot for starting typing the InlineMathCell part. When typing the content of the InlineMathCell is slightly highlighted by a light pink color. As soon as the typing goes outside of the InlineMathCell, the highlighting disappears, and the InlineMathCell background looks white.

My question is: How can I change the highlighting color of an InlineMathCell to make it more visible?

Reaction to the statement that this question already has an asnwer: NO IT HAD NOT BEFORE THE PRESENT ANSWER OF SILVIA. See the discussion below.

-
@Silvia seems, He is not searching for background color, but hilighting color, that's also the op's previous question. – HyperGroups Jun 17 '13 at 10:29
@HyperGroups IMO, with the method in the post I linked, there is no difference between adjusting the Background, the FontColor, the FontFamily or any other style things. – Silvia Jun 17 '13 at 10:34
@Silvia Hilighting color is something temporary, and its style will disappear after ending the inline cell. Maybe should use CellEventActions in stylesheet. I've tried a little, but still not succesful for only inline cell. – HyperGroups Jun 17 '13 at 10:40
@HyperGroups Ahh... I see your point. Sorry I misundertood OP's question. It can't be un-voted, but other folks would vote to leave it open. – Silvia Jun 17 '13 at 10:43
@MichaelE2 I think it's not exactly the same problem. I think what OP wants is a temporary style which applies to a inline cell only when the cursor is in it. And when the cursor is out of it, its style should automatically fall back to "InlineCell". Please see the video in my answer for more precise what I mean. – Silvia Jun 18 '13 at 19:25

Sorry I voted as duplicate because I misunderstood the question.

If you want to tune the style of inline cells, you can adjust the "InlineCell" style.

If you want to tune the style of inline cells that presents when editing the cell, there is a similar style called "InlineCellEditing".

An example used by myself:

Cell[StyleData["InlineCellEditing"],
FontFamily->"Constantia",
FontColor->RGBColor[0.5019607843137255, 0., 0.5019607843137255],
Background->RGBColor[0.964706, 0.929412, 0.839216]]


Edit:

According to OP's comment, I made a video to demonstrate how to setup the style (please choose 720p quality for detail view):

-
I think I would upvote if I knew how stylesheets worked :). – Jacob Akkerboom Jun 17 '13 at 11:07
@JacobAkkerboom Stylesheets are great tools. Maybe you would be interested in stylesheet. :) – Silvia Jun 17 '13 at 11:11
I'll keep that in mind, but I suppose I could invest more 5-10 minutes looking at the relevant doc pages also :). I guess I'm not one for style, Raw Inputform appeals to me :P. – Jacob Akkerboom Jun 17 '13 at 11:18
@JacobAkkerboom Yes the official documentations are definitely the best place to start. – Silvia Jun 17 '13 at 11:36
@Silvia Thank you. This looks like a very reasonable solution. However, I made a StyleSheet on the basis of the JournalArticle, in which I have inserted the cell from above, and though it should work, it does not. – Alexei Boulbitch Jun 18 '13 at 7:58

I came up with this, not so good, hope for someone will develop this.

CellPrint@Cell["This is one InlineFourmula Style Cell", "InlineFormula", CellEventActions ->
{
"MouseMoved" :> (SelectionMove[InputNotebook[], All, ButtonCell];
SetOptions[NotebookSelection[InputNotebook[]], Background -> LightGreen, FontColor -> Red]),
"ReturnKeyDown" :> (SelectionMove[InputNotebook[], All, ButtonCell];
SetOptions[NotebookSelection[InputNotebook[]], Background -> Inherited,
FontColor -> Green, FontSize -> 25])}
]


And this StyleData in one stylesheet only take effect for InlineFormula style cell but not InlineFormula style inline cell What a pity.

Cell[StyleData["InlineFormula"],
CellEventActions->{"MouseMoved" :> SetOptions[
NotebookSelection[
InputNotebook[]], Background -> Green], "ReturnKeyDown" :> SetOptions[
NotebookSelection[
InputNotebook[]], Background -> LightRed]},
FontSize->24,
Background->RGBColor[0, 1, 0]]


ReturnKey will change the background color temporarily

-