The least distance of $f\in\ell_\infty(K,\mathbb C)$ from $C(K,\mathbb C)$ Suppose that $K$ is a compact Hausdorff space. Consider a bounded function $f:K\to\mathbb R$ not necessarily continuous, that is, $f\in\ell_\infty(K,\mathbb R)$. It's a well-known fact that the least distance of $f$ from some continuous $g:K\to \mathbb R$ is half of the maximum oscilation of $f$. More precisely, we define the oscilation of $f$ at $k$ by
$$
osc_f(k) = \inf_{U\in\mathcal V_k} \sup_{u,v\in U} |f(u)-f(v)|,
$$
where $\mathcal V_k$ is the set of open neighborhoods of $k$, and we have the following result, which is the Proposition 1.18.(ii) of the book Geometric Nonlinear Functional Analysis, by Y. Benyaminni and J. Lindenstrauss:

Let $f:K\to\mathbb R$ and put $\delta =\|osc_f\|_\infty$, where $\|\cdot\|_\infty$ is the supremum norm. Then, there exists a continuous function $g:K\to\mathbb R$ such that
$$
\|f-g\|_\infty=\frac{\delta}{2},
$$
and this is the least distance of a continuous function from $f$.

So, here is my question:

Is there an analogous result for $\mathbb C$, instead of $\mathbb R$?

EXAMPLE: Let us see a function $f: K \to \mathbb C$ such that the least distance of this function to a continuous function is not $\delta/2$. Put $K=[0,1]$ and define for each $k\in[0,1]$:
$$
f(k) = \left\{\begin{array}{rl} 1 &,\mbox{ if $k$ is rational}\\
e^{\frac{\pi i}{3}} &,\mbox{if $k$ is not rational, but is algebraic} \\
e^{-\frac{\pi i}{3}} &, \mbox{if $k$ is transcendental}\end{array}\right.
$$
The image of this function is equal to the vertices of an equilateral triangle centered at the origin of the complex plane. The oscillation of this function in any $k$ is equal to the length of the side of this triangle, that is, $\sqrt3$. But there is no point whose distance is less than $\sqrt3/2$ to all the vertices of the triangle. The continuous function that has the least distance to $f$ is the zero function $k\mapsto 0$, and this distance is equal to $1$.
 A: This answer seems to be alright. The least distance will be the parameter $\gamma$ to be defined further. This parameter is equal to the half of the maximum oscilation in the real context, so it generalizes the result mentioned in the question.
For each set $S\subset \mathbb C$, denote by $p(S)\in\mathbb C$ and $r(S)>0$ the ones satisfying
$$
S\subset \overline B(p(S),r(S)),
$$
where $r(S)$ is the smallest radius for such ball.
Given $f: K \to \mathbb C$, define, for each $k\in K$, the set
$$
\overline f(k) = \{a\in\mathbb C: a=\lim_{i\in I} f(k_i),\mbox{ for some $k_i\to k$}\}.
$$
If a function $g: K \to \mathbb C$ is continuous, notice that, for any $k_i\to k$, we must have
$$
|g(k_i)-f(k_i)| \leq \|f-g\|_\infty,\ \forall i\in I, 
$$
and $g(k_i) \to g(k)$, then, certainly,
$$
\overline f(k) \subset \overline B(g(k),\|f-g\|_\infty),
$$
which means that
$$
\gamma = \sup_{k\in K} r(\overline f(k)) \leq \|f-g\|_\infty.
$$
So the distance of $f$ to a continuous function is at least $\gamma$. Now, let us construct a continuous $g$ such that $\|f-g\|_\infty=\gamma$.
For each $k\in K$, we define $G: K \to \mathcal P(\mathbb C)$ by
$$
G(k) = \bigcap_{a\in \overline f(k)} \overline B(a,\gamma).
$$
Then, for each $k$, $G(k)$ is a closed convex set, because it is the intersection of such sets, and $G(k)\neq\emptyset$, for
$$\overline f(k) \subset \overline B(p(\overline f(k)),r(\overline f(k)))\ \ \Rightarrow\ \ p(\overline f(k)) \in \bigcap_{a\in \overline f(k)} B(a,r(\overline f(k))) \subset \bigcap_{a\in \overline f(k)} B(a,\gamma) = G(k).$$
Now, we will prove that, for any $b\in G(k)$ and $\varepsilon'>0$, there exists an open neighborhood $U\ni k$ such that $d(b,G(u))<\varepsilon'$ for all $u\in U$. This property corresponds to the function $G$ being a lower hemicontinuous set-valued function, which is a hypothesis for Michael's selection theorem, that will be used further.
First observe that, given $\varepsilon>0$, it must exist an open neighborhood $U\ni k$ such that, for any $u\in U$,
$$
d(f(u),\overline f(k))\leq\varepsilon,
$$
(this fact can be proven by assuming the contrary and then constructing a net $k_i\to k$ such that $\lim_{i\in I} f(k_i) \notin \overline f(k)$, a contradiction with the definition of $\overline f(k)$). Then,
$$
d(\overline f(u),\overline f(k))\leq\varepsilon,\ \forall u\in U.
$$
Fixing such $U$, let $b\in G(k)$. If $u\in U$, then
$$
d(\overline f(u),\overline f(k))\leq \varepsilon,
$$
so, for any $a\in \overline f(u)$, there exists $a'\in \overline f(k)$ such that
$
|a'-a| \leq \varepsilon,
$
and then, since $b\in G(k) \subset \overline B(a',\gamma)$, we conclude that
$$
|b-a| \leq |b-a'| + |a'-a|\leq \gamma +\varepsilon,
$$
which means that
$$
\overline f(u) \subset \overline B(b,\gamma+\varepsilon).
$$

Claim. If $(\gamma +\varepsilon')^2\leq \gamma^2 + \varepsilon^2$, then $d\left(b,G(u)\right)\leq\varepsilon$.

We write $R=\gamma+\varepsilon'$, then $R^2\leq \gamma^2 + \varepsilon^2$.
Consider $p=p(\overline f(u))$ and $r=r(\overline f(u))$. To simplify, we may assume that $b=0$ and  $p\in\mathbb R^+$.
If $p\leq \varepsilon$, since $p\in G(u)$,  the claim follows immediately, so we assume that $p>\varepsilon$. It suffices to prove that  $$\overline f(u) \subset \overline B(\varepsilon,\gamma),$$ which is equivalent to $\varepsilon\in G(u)$, which will conclude the proof.
Fix $a\in \overline f(u)$ and write
$$
    a = \varepsilon + s e^{\theta i} = \left(\varepsilon+s\cos\theta, s\sin\theta\right),
$$
so our task is to prove that $s\leq\gamma$. Since $\overline f(u)\subset \overline B(0,R)\cap\overline B(p,r)$, we have
$$
\left\{\begin{array}{r} \varepsilon^2 + 2\varepsilon s\cos\theta + s^2 = |a-0|^2   \leq  R^2 \\
(p-\varepsilon)^2 - 2(p-\varepsilon)s\cos\theta + s^2 = |a-p|^2  \leq  r^2 \ \end{array}\right.,
$$
then,
$$
\frac{(p-\varepsilon)^2 + s^2-r^2}{2(p-\varepsilon)s} \leq \cos\theta \leq \frac{R^2-\varepsilon^2-s^2}{2\varepsilon s}.
$$
Working with the extremes of the inequality, we obtain that
\begin{align*}
    s^2 & \leq \varepsilon^2 - p\varepsilon + \left(1-\frac{\varepsilon}{p}\right)R^2 + \frac{\varepsilon}{p}r^2 \\
    & \leq  \varepsilon^2 - p\varepsilon + \left(1-\frac{\varepsilon}{p}\right)(\gamma^2 + \varepsilon^2) + \frac{\varepsilon}{p}\gamma^2 \\
    & = \gamma^2 - \frac{\varepsilon}{p}(p-\varepsilon)^2 \\
    & < \gamma^2,
\end{align*}
which means that $u\in \overline B(\varepsilon, \gamma)$, as we wished, o the claim is proved.
By picking $\varepsilon'>0$ such that $(\gamma+\varepsilon')^2 \leq \gamma^2 + \varepsilon^2$ and applying the claim we conclude the proof that $G$ is a lower hemicontinuous set-valued function. Therefore, we are under the hypothesis of Michael's selection theorem:

Let $K$ be a paracompact space and $E$ a Banach space. Suppose that $\Phi: K \to \mathcal P(E)$ is a lower hemicontinuous function satisfying that, for any $k\in K$, $\Phi(k)$ is a non-empty closed convex set. Then, there exists a continuous function $\phi:K\to E$ such that $\phi(k) \subset \Phi(k)$, for any $k\in K$.

Applying this theorem, we obtain a continuous function $g: K \to \mathbb C$ such that, for any $k\in K$, since $f(k)\in \overline f(k)$, we have
$$
g(k)\subset G(k) \subset \overline B(f(k),\gamma) \Rightarrow |g(k)-f(k)| \leq \gamma,
$$
as we wished.
