Menu

#2055 Scintilla Cocoa InfoBar unreadable in OSX Mojave dark mode w/Xcode 10

Bug
closed-fixed
5
2019-01-11
2018-10-19
No

When Scintilla is compiled with Xcode 10, it automatically adjusts to the system appearance mode (dark mode vs. light mode). But the InfoBar uses a fixed color background, which renders the white text unreadable when the system is in dark mode.

I have tested a simple fix in which InfoBar draws a solid background in the controlBackgroundColor, which tracks dark/light mode. Then the gradient is drawn over it. I have replaced the InfoBar background resources (info_bar_bg.png and info_bar_bg@2x.png) with translucent equivalents (attached to this report). The InfoBar drawRect method requires a slight change:

/**
 * Fill the background.
 */
- (void) drawRect: (NSRect) rect {
    [[NSColor controlBackgroundColor] set];
    [NSBezierPath fillRect: rect];

    // Since the background is seamless, we don't need to take care for the proper offset.
    // Simply tile the background over the invalid rectangle.
    if (mBackground.size.width != 0) {
        NSPoint target = {rect.origin.x, 0};
        while (target.x < rect.origin.x + rect.size.width) {
            [mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositingOperationSourceOver fraction: 1];
            target.x += mBackground.size.width;
        }
    }

The controlBackgroundColor background fill is done first and the gradient compositing mode is changed from NSCompositingOperationCopy to NSCompositingOperationSourceOver.

2 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2018-10-20

    This changes the appearance a little - there is a heavier 'bulge' and no top separator line in light mode.
    Top is original

    I don't personally use the info bar so have no strong preference but others may.

     
  • John Horigan

    John Horigan - 2018-10-20

    Here is another pair of PNGs that reduces the bulge and adds back the separator line. I used the Digital Color Meter tool to get a much closer match to the original background.

     
  • Neil Hodgson

    Neil Hodgson - 2018-10-21

    Committed as [2f5d50].

     

    Related

    Commit: [2f5d50]

  • Neil Hodgson

    Neil Hodgson - 2018-10-21
    • labels: --> scintilla, cocoa
    • status: open --> open-fixed
    • assigned_to: Neil Hodgson
     
  • Neil Hodgson

    Neil Hodgson - 2019-01-11
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.