Making real Dark Mode edit view

I’m not quite happy with how the Edit View remains white, and want to make a reporter plugin that alters the appearance. I have three questions:

  • What is the best way to fill the edit view with a different colour? I was thinking of drawing a massive rectangle in the back, but it feels clumsy.
  • Related to the above, I am using the SDK template, in which preview() method exists. Its layer only covers the bounds of each bezier path and I cannot fill the whole preview area with my knowledge. How can I get the NSRect of the area?
  • How can I cancel the default drawing of inactive layers and previews so that I can fill the letterforms with white? Currently I can only draw stuff behind of on top what’s already drawn, and feels wasteful.
1 Like

There is a userDefaults setting to switch the edit view to dark mode:

Glyphs.boolDefaults["GSEditViewDarkMode"] = True
1 Like

doing dark mode in a reporter plugin is not possible. You would need to reimplement all drawing.

Thanks, I was guessing that might be the case. I could get reasonably close to that though.
But could you answer my questions anyway so that I can learn?

  1. Filling the rect is all you can do.
  2. rect = Font.currentTab.graphicView().bounds()
  3. self.needsExtraMainOutlineDrawingForInactiveLayers = False

The problem with .graphicView().bounds() is that I cannot use it straight away. I can change size using scale of course, but the origin point is based on the location of the currently selected glyph. For example, this doesn’t really fill the view in the way I want:

In some of the reporter methods, the coordinates are set to the active layers origin. Then you need to move your code to a different method backgroundInViewCoords() could work. Or directly drawBackgroundWithOptions_().

1 Like

Hi George
can i use thie script

Glyphs.boolDefaults["GSEditViewDarkMode"] = True

to work with dark mode on OSX High Sierra?

This might work. I don’t have a High Sierra machine at hand right now:
You need to run this every time you open a new tab:

from AppKit import NSAppearance

And this if you like to deactivate it:

1 Like