SimpleTextAttributes (SimpleTextAttributes attributes) { Color bgColor = textAttributes.getBackgroundColor(); try { textAttributes.setBackgroundColor(null); return SimpleTextAttributes.fromTextAttributes(TextAttributes.merge(attributes.toTextAttributes(), textAttributes)); } finally { textAttributes.setBackgroundColor(bgColor); } }