A nice and hard colouring problem
Assume $2\leq A<B$. Then $B=qA+r$ with $q\geq1$, $\>1\leq r\leq A-1$, and $r$ prime to $A$.
Imagine an "abstract" regular $A$-gon with vertex set $V\sim{\mathbb Z}/A$. If we draw the $A$ chords $\{k,k+r\}$ we obtain a cyclic graph $\Gamma$. Omitting an edge from $\Gamma$ leaves a connected graph $\Gamma'$, but if we omit $\geq2$ edges from $\Gamma$ the resulting graph on $V$ is no longer connected.
The set $[n]:=\{1,2,\ldots, n\}$ splits into $A$ remainder classes modulo $A$. All members of the same class are colored with the same color; hence each class has its color. Some of these classes are related by a $B$-jump and therefore are assigned the same color. The possible $B$-jumps are $$1\to1+B, \quad 2\to 2+B, \quad \ldots, \quad n-B\to n\ .$$ The first $A$ of these jumps lead to different edges of $\Gamma$.
If $n-B\leq A-2$, or $n\leq A+B-2$, then not all classes modulo $A$ are connected by $B$-jumps, hence a nonconstant coloring of $[n]$ of the desired kind is possible. If, however, $n-B\geq A-1$, or $n\geq A+B-1$, then $\geq A-1$ different chords in $\Gamma$ are realized, which then implies that all remainder classes modulo $A$ will get the same color.