gCode Viewer Colours


I am using Octopi - OctoPrint 1.3.9 on a Raspberry Pi 3 B+ driving a Prusa i3 MK3

Is it possible to change the colours used in the gCode Viewer. There isn't much contrast between the grey (last layer) and black (current layer).


Chris Morgan


Let's see if we can do this...

I'm currently running a job so I:

  1. Visit the Gcode Viewer tab
  2. Right-mouse click and choose Inspect (Safari browser)
  3. Navigate down until I see <canvas id="gcode_canvas".../> and assume that this is what I'm after
  4. I visit the github and search for this term in the code... which doesn't turn up what I'm looking for
  5. Further searching finds me this JS which is
        colorGrid: "#bbbbbb",
        bgColorGrid: "#ffffff",
        bgColorOffGrid: "#eeeeee",
        colorLine: ["#000000", "#3333cc", "#cc3333", "#33cc33", "#cc33cc"],
        colorMove: "#00ff00",
        colorRetract: "#ff0000",
        colorRestart: "#0000ff",
        colorHead: "#00ff00",

...and this code at line 546:

            // alpha value (100% if current layer is being rendered, 30% otherwise)
            var alpha = (renderOptions['showNextLayer'] || renderOptions['showPreviousLayer']) && isNotCurrentLayer ? 0.3 : 1.0;
            var shade = tool * 0.15;

...seems to be altering the alpha (opacity/transparency) setting of colors if we know that the user has navigated forward/backward and not viewing the current layer.

So, she's changing the black (#000000) to 30% alpha when you navigate to something other than the current layer.

Exercising this now in my browser, I'm not seeing a difference anywhere on the canvas.