You can use CellEventActions by adding it to the Stylesheet or hard-coding it for each cell. Here is a cell that changes when clicked.
DynamicModule[{bgd = LightRed},
CellPrint[
TextCell["Click within this cell", "Output",
Background -> Dynamic[bgd],
CellEventActions -> {"MouseClicked" :> (bgd = LightGreen)}
]
]
];
Rather than having it change once you can have it set a variable that indicates the CellID or something which determines whether or not the cell should be highlighted, such as the following two cells which toggle back and forth when clicked (disclaimer, this uses a lot of Dynamic stuff and may choke the frontend):
DynamicModule[{selected = 3},
CellPrint[{
TextCell["Click within this cell", "Output",
Background -> Dynamic[If[selected === 1, Yellow, Gray]],
CellEventActions -> {"MouseClicked" :> (selected = 1)}],
TextCell["Click within this cell", "Output",
Background -> Dynamic[If[selected === 2, Yellow, Gray]],
CellEventActions -> {"MouseClicked" :> (selected = 2)}]
}]
];
UPDATE (to embed in stylesheet):
The following let's this work in a stylesheet, although MouseDown and MouseUp behave differently when clicking between cells and this will cause some unexpected behaviour.
Cell[
StyleData["Text"],
CellEventActions -> {
"MouseDown" :> SetOptions[EvaluationCell[], Background -> GrayLevel[0.5]],
"MouseUp" :> Quiet[
SetOptions[EvaluationCell[], Background -> GrayLevel[1]];
SelectionMove[EvaluationCell[], All, Cell];
FrontEndTokenExecute["OpenCloseGroup"]
],
PassEventsDown -> True
}
(*uncomment the following if you want Deployed like WholeCellGroupOpener*)
(*,
Deployed -> True
*)
]
UPDATE 2: Probably what you were looking for
Cell[StyleData["Text"],
CellEventActions->{
"MouseDown" :>
With[{cell = EvaluationCell[]},
SetOptions[cell, Background -> GrayLevel[0.5]];
RunScheduledTask[SetOptions[cell, Background -> GrayLevel[1]], {0.2, 1}]],
"MouseUp" :> RemoveScheduledTasks[ScheduledTasks[]],
PassEventsDown -> True},
WholeCellGroupOpener -> True
]