# How to retrieve current FaceForm?

The current colour in a Graphics object can be retrieved using CurrentValue["Color"] for use in Dynamic stuff.

Example:

Graphics[
{RGBColor[2/3, 1/3, 2/3],
Dynamic[{If[CurrentValue["MouseOver"],
Darker@CurrentValue["Color"]], Disk[]}]
}]


How can I retrieve the current FaceForm colour?

Graphics[
{FaceForm[RGBColor[2/3, 1/3, 2/3]], EdgeForm[Black],
Dynamic[{
If[CurrentValue["MouseOver"],
Darker@CurrentValue[(* what do I write here? *)]],
Disk[]}]
}]

• @Kuba Here is a nice use of CurrentValue["Color"] if you have not seen it before. – Mr.Wizard Jun 27 '15 at 13:48
• @Kuba It's not at all academic. I have a plotting function that plots some sort of "map", with the colours for each map area coming from the user. At some point I found a need to highlight each area on hover, preferably while still keeping the shade of its colour. Having access to the current colour value simplifies the code a lot because I don't need to re-build the whole map from the source data to add highlighting, I can just modify it. In other words, it's not necessary to store the colours separately, they can just be a natural part of the Graphics object. – Szabolcs Jun 27 '15 at 14:27
• @Kuba What did you mean then? – Mr.Wizard Jun 27 '15 at 15:24
• @Kuba Like this :-). I was using tooltips to identify which area was which, but it turns out that sometimes the pointer location is inaccurate. So I needed confirmation to know that I was indeed hovering the area I thought I was hovering. – Szabolcs Jun 27 '15 at 15:25
• @Mr.Wizard Maybe I was too picky but OP example just asks about this approach. Moreover, I'm a little bit of pejudiced about styles/events inheritance as I faced couple of "exceptions" with events handlers. That's why I'm usually starting with brute force approach in such cases :) – Kuba Jun 27 '15 at 15:30

I believe you want "FrontFaceColor" which can be found as a specification in this list:

Graphics[{FaceForm[RGBColor[2/3, 1/3, 2/3]], EdgeForm[Black],
Dynamic[{If[CurrentValue["MouseOver"], Darker @ CurrentValue["FrontFaceColor"]],
Disk[]}]}]


You may also find "FrontFaceOpacity" of use.

Simply guessing I found that "BackFaceColor" is also valid, e.g.:

Graphics3D[
{FaceForm[Yellow, Blue],
Dynamic[{If[CurrentValue["MouseOver"], CurrentValue["BackFaceColor"]], Cuboid[]}]
},
PlotRange -> {{-1/4, 5/4}, {1/4, 5/4}, {-1/4, 5/4}}
]


• And there's also EdgeColor. Excellent! Thank you, this'll simplify my code significantly. – Szabolcs Jun 27 '15 at 14:24
• @Szabolcs You're welcome. I would appreciate your vote on this if I do not have it already; there's lots of great stuff in there just waiting to be applied! – Mr.Wizard Jun 27 '15 at 14:26