Small fixes
[vchess.git] / client / src / utils / printDiagram.js
index 524e12b..ef0d2b5 100644 (file)
@@ -73,6 +73,7 @@ export function getDiagram(args) {
   // Obtain the array of pieces images names:
   const board = V.GetBoard(args.position);
   const orientation = args.orientation || "w";
+  const darkBottomRight = !!args.darkBottomRight;
   const markArray = getMarkArray(args.marks);
   const shadowArray = getShadowArray(args.shadow);
   const vr = new V(); //just for pieces images paths
@@ -90,8 +91,16 @@ export function getDiagram(args) {
           (V.Notoodark ? "middle-square" : "dark-square");
         if (j == startY) boardDiv += " border-left";
       }
-      else if ((i + j) % 2 == 0) boardDiv += "light-square";
-      else boardDiv += "dark-square";
+      else {
+        const oddity = (i + j) % 2;
+        if (
+          (oddity == 0 && !V.DarkBottomRight) ||
+          (oddity == 1 && V.DarkBottomRight)
+        ) {
+          boardDiv += "light-square";
+        }
+        else boardDiv += "dark-square";
+      }
       boardDiv += " " + store.state.settings.bcolor;
       if (shadowArray.length > 0 && shadowArray[i][j])
         boardDiv += " in-shadow";