Yes, if $K$ is open and closed, $1_K$ is continuous as I show here.

OTOH, if $1_K$ is continuous $K = 1_K^{-1}[\{1\}] = 1_K^{-1}[\{(0,+\infty)\}]$ is open and closed.

So both directions hold.