private TextAttributes tuneAttributes(TextAttributes attributes) {
      if (attributes != null) {
        attributes = attributes.clone();
        Color foregroundColor = attributes.getForegroundColor();
        Color backgroundColor = attributes.getBackgroundColor();
        if (foregroundColor != null) attributes.setForegroundColor(tuneColor(foregroundColor));
        if (backgroundColor != null) attributes.setBackgroundColor(tuneColor(backgroundColor));
      }
      return attributes;
    }
private TextAttributes tuneAttributes(TextAttributes attributes)