@@ -1222,6 +1222,13 @@ function sanitizeColorSetIndex(value) {
12221222 return Math . min ( numeric , NKANT_COLOR_SET_COUNT ) ;
12231223}
12241224
1225+ function remapLegacyColorSetIndex ( value ) {
1226+ const numeric = Number . parseInt ( value , 10 ) ;
1227+ if ( ! Number . isFinite ( numeric ) || numeric < 1 ) return value ;
1228+ if ( numeric <= NKANT_COLOR_SET_COUNT ) return numeric ;
1229+ return ( ( numeric - 1 ) % NKANT_COLOR_SET_COUNT ) + 1 ;
1230+ }
1231+
12251232function ensurePalette ( base , count , fallback ) {
12261233 const sanitizeList = values => {
12271234 if ( ! Array . isArray ( values ) ) return [ ] ;
@@ -5385,7 +5392,7 @@ function loadCleanNKantState(rawState) {
53855392 nextState . rotateText = opt . rotateText ;
53865393 }
53875394 if ( opt . colorSet != null ) {
5388- nextState . colorSetIndex = sanitizeColorSetIndex ( opt . colorSet ) ;
5395+ nextState . colorSetIndex = sanitizeColorSetIndex ( remapLegacyColorSetIndex ( opt . colorSet ) ) ;
53895396 }
53905397 if ( opt . defaults && typeof opt . defaults === "object" ) {
53915398 nextState . defaults = {
@@ -5412,7 +5419,7 @@ function loadCleanNKantState(rawState) {
54125419 fig . color = entry . color . trim ( ) ;
54135420 }
54145421 if ( entry && entry . colorSet != null ) {
5415- fig . colorSetIndex = sanitizeColorSetIndex ( entry . colorSet ) ;
5422+ fig . colorSetIndex = sanitizeColorSetIndex ( remapLegacyColorSetIndex ( entry . colorSet ) ) ;
54165423 }
54175424
54185425 const labels = entry && entry . labels && typeof entry . labels === "object" ? entry . labels : null ;
0 commit comments