Let $X$ be a topological space and $A$ be a subset of $X$. Is there any nice condition on $A$ equivalent to the property that if $C$ is a connected component of $X$, then either $A\cap C=\emptyset$ or for every continuous real valued function $f$ on $X$ (i.e, $f\in C(X)$) if $f(A\cap C)\subseteq\{0, 1\}$, then $f$ must be constant on $A\cap C$?

For example, dense subspaces of $X$ have this property. Also, connected components of $X$ have this property.