[Bug 1894419] Re: Wrong TextPane.background color with GTKLookAndFeel on dark theme
Hi, here is the reproducer; OpenJDK version/OS version: openjdk 11.0.8 2020-07-14 / Mint Linux 20 openjdk 1.8.0_265 / Ubuntu 20.04 import java.awt.*; import javax.swing.*; import javax.swing.text.html.HTMLDocument; import javax.swing.text.html.StyleSheet; public class Example { private String toHex(Color color) { return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()); } public Example() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } JFrame frame = new JFrame(); JTextPane pane = new JTextPane(); pane.setContentType("text/html"); ((HTMLDocument) pane.getDocument()).setPreservesUnknownTags(false); String text = "Displays the text using htmlDocument class " + "font color : TextPane.foreground=" + toHex(UIManager.getColor("TextPane.foreground")) + " background color : TextPane.background=" + toHex(UIManager.getColor("TextPane.background")) + " background color should lighter when light mode and darker when dark mode."; StyleSheet styleSheet = ((HTMLDocument) pane.getDocument()).getStyleSheet(); styleSheet.addRule("body { font-family: Arial; font-size: 24pt; font-style: bold;" + " color: " + toHex(UIManager.getColor("TextPane.foreground")) + "; " + " background: " + toHex(UIManager.getColor("TextPane.background")) + "; " + " }"); pane.setText(text); pane.setPreferredSize(new Dimension(800, 200)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(pane, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { new Example(); } } ** Attachment added: "Screencapture on Ubuntu 20.04 with reproducer" https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+attachment/5416409/+files/Screenshot%20from%202020-10-02%2012-43-11.png -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1894419 Title: Wrong TextPane.background color with GTKLookAndFeel on dark theme To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1894419] Re: Wrong TextPane.background color with GTKLookAndFeel on dark theme
** Attachment added: "screen capture on Mint Linux 20 dark mode with reproducer" https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+attachment/5416410/+files/mint-dark-mode-reproduce.png -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1894419 Title: Wrong TextPane.background color with GTKLookAndFeel on dark theme To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1894419] Re: Wrong TextPane.background color with GTKLookAndFeel on dark theme
Forgot to add what happened in my case. - background was dark - text was white I modified the code a bit to simplify it: import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JTextPane; public class Example { public Example() { JFrame frame = new JFrame(); JTextPane pane = new JTextPane();; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pane.setPreferredSize(new Dimension(200, 200)); frame.getContentPane().add(pane, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { new Example(); } } ** Changed in: openjdk-lts (Ubuntu) Status: New => Incomplete -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1894419 Title: Wrong TextPane.background color with GTKLookAndFeel on dark theme To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1894419] Re: Wrong TextPane.background color with GTKLookAndFeel on dark theme
Thank you for taking the time to report this bug and helping to make Ubuntu better. I tried the code in https://stackoverflow.com/a/31928409 with Ayu- Mirage-Dark and I couldn't reproduce the issue. Please provide the following items: - a reproducer with actual code - the exact OpenJDK version - which Ubuntu release was this tested on I'm setting it as incomplete for now. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1894419 Title: Wrong TextPane.background color with GTKLookAndFeel on dark theme To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1894419] Re: Wrong TextPane.background color with GTKLookAndFeel on dark theme
The attachment "Fix openjdk GTK LaF color bug" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team. [This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.] ** Tags added: patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1894419 Title: Wrong TextPane.background color with GTKLookAndFeel on dark theme To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1894419/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs