title: Drawing artefact with a NSBackgroundStyleRaised text field when the parent view draws a gradient
body: <p>Here is a NSView subclass that simply draws a subtle blue gradient (it's hard to see in this image but it is there) in it's bounds. Inside the view I place an NSTextField and set the cell to have NSBackgroundStyleRaised. The artefact is the background of the text field is draws with what looks like the same colour as it's superview. In this case the superview draws a gradient things look strange. </p>
  
  <p><img src="https://i.stack.imgur.com/XfRwg.png" alt="View with gradient."></p>
  
  <p>The <code>-drawRect:</code> for the blue view is,</p>
  
  <pre><code>- (void)drawRect:(NSRect)dirtyRect
  {
      [super drawRect:dirtyRect];
  
      // Base colours
      baseColor = [NSColor colorWithCalibratedRed: 0.271 green: 0.578 blue: 0.874 alpha: 1];
      baseColorDarkened = [NSColor colorWithCalibratedRed: 0.159 green: 0.491 blue: 0.911 alpha: 1];
  
      // Draw gradient
      NSGradient* gradient = [[NSGradient alloc] initWithStartingColor:baseColor  endingColor:baseColorDarkened];
      NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRect:dirtyRect];
      [gradient drawInBezierPath: rectanglePath angle: 90];
  
      // Draw thin border
      NSBezierPath *border = [NSBezierPath bezierPath];
      [[baseColorDarkened blendedColorWithFraction:0.2 ofColor:[NSColor blackColor]] set];
      [border setLineWidth:1];
      [border stroke];
  }
  </code></pre>
  
  <p>I'm using a document based application so in <code>-windowControllerDidLoadNib:</code> I set the properties of the text field,</p>
  
  <pre><code>- (void)windowControllerDidLoadNib:(NSWindowController *)aController
  {
      [super windowControllerDidLoadNib:aController];
  
      [[_label1 cell] setBackgroundStyle:NSBackgroundStyleLowered];
      [_label1 setBackgroundColor:[NSColor clearColor]]; // &lt;-- Doesn't help :(
  }
  </code></pre>