2
$\begingroup$
Clear["Global`*"];
Table[FlipView[Framed[Style["A", 32, Black, Bold]
     , ImageSize -> {60, 60}, Alignment -> Center, 
     Background -> #] & /@ Lighter@{Red, Green, Blue}, 1], {4}]

enter image description here

Question

As the colors change upon clicking, I would like to get the colors (or indices of the colors) for the four items as a list. How can this be done?

Thanks for your help.

$\endgroup$

1 Answer 1

2
$\begingroup$

FlipView allows the second argument to be Dynamic.

k = Table[1, {4}];
Table[With[{i = i}, 
  FlipView[
   Framed[Style["A", 32, Black, Bold], ImageSize -> {60, 60}, 
      Alignment -> Center, Background -> #] & /@ 
    Lighter@{Red, Green, Blue}, Dynamic[k[[i]]]]], {i, 4}]

Dynamic@k
(* {1, 1, 1, 1} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.