Example 5 Given that when $x \in[0,1]$, the inequality
$$
x^{2} \cos \theta-x(1-x)+(1-x)^{2} \sin \theta>0
$$

always holds. Try to find the range of $\theta$.
Solution: If for all $x \in [0,1]$, we have
$$
f(x) = x^{2} \cos \theta - x(1-x) + (1-x)^{2} \sin \theta > 0 \text{.}
$$

Then $\cos \theta = f(1) > 0$, $\sin \theta = f(0) > 0$.
Let $x_{0} = \frac{\sqrt{\sin \theta}}{\sqrt{\cos \theta} + \sqrt{\sin \theta}} \in (0,1)$, then
$$
\sqrt{\cos \theta} x_{0} - \sqrt{\sin \theta} (1 - x_{0}) = 0 \text{.}
$$

Since $f(x) = [\sqrt{\cos \theta} x - \sqrt{\sin \theta} (1 - x)]^{2} + 2 \left(-\frac{1}{2} + \sqrt{\sin \theta \cdot \cos \theta}\right) x (1 - x)$, then
$$
0 < f(x_{0}) = 2 \left(-\frac{1}{2} + \sqrt{\sin \theta \cdot \cos \theta}\right) x_{0} (1 - x_{0}) > 0.
$$
Conversely, when (1) and (2) hold,
$$
f(0) = \sin \theta > 0, \quad f(1) = \cos \theta > 0 \text{.}
$$

Also, for $x \in (0,1)$,
$$
f(x) \geqslant 2 \left(-\frac{1}{2} + \sqrt{\sin \theta \cdot \cos \theta}\right) x (1 - x) > 0.
$$
First, solve (1) and (2) on $[0, 2\pi]$.
From $\cos \theta > 0$, $\sin \theta > 0$, we get
$$
\begin{array}{l}
0 < \sin \theta, \cos \theta < 1 \\
\Rightarrow \sqrt{\sin \theta \cdot \cos \theta} > \frac{1}{2} \\
\Rightarrow \frac{1}{2} \sin 2 \theta > \frac{1}{4} \Rightarrow \sin 2 \theta > \frac{1}{2}.
\end{array}
$$

Noting that $0 < 2 \theta < \pi$, we have $\frac{\pi}{6} < 2 \theta < \frac{5 \pi}{6}$.
Thus, $\frac{\pi}{12} < \theta < \frac{5 \pi}{12}$.
Therefore, the range of $\theta$ is
$$
2 k \pi + \frac{\pi}{12} < \theta < 2 k \pi + \frac{5 \pi}{12}, \quad k \in \mathbf{Z}.
$$