# Change button color on odd clicks

**URL:** <https://discourse.julialang.org/t/change-button-color-on-odd-clicks/59123>\
**Category:** General Usage\
**Tags:** interactivity\
**Created:** [April 12, 2021, 4:26pm UTC](https://discourse.julialang.org/t/change-button-color-on-odd-clicks/59123 "2021-04-12T16:26:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saraflgarcia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/saraflgarcia/32/14847_2.png) [@saraflgarcia](https://discourse.julialang.org/u/saraflgarcia)\
**Post date:** [April 12, 2021, 4:26pm UTC](https://discourse.julialang.org/t/change-button-color-on-odd-clicks/59123/1 "2021-04-12T16:26:53Z")

</div>

Hello everyone,

With Julia Interact, how can I change button color on odd clicks?

Here’s my unsuccessful attempt:  
heart(color) = button(latex(“\heartsuit”),  
style=Dict(:color =\> color,  
:backgroundColor =\> “white”,  
:width =\> “40px”,  
:height =\> “40px”,  
:fontSize =\> “30px”))

heart\_button() =  
@manipulate for b=heart(“gray”)  
if b == 0  
nothing  
elseif isodd(b)  
heart(“black”)  
display(“black”)  
else  
display(“white”)  
end  
end

heart\_button()

Thanks in advance!
