Linux's KDE defines themes that set the color scheme and style for window frames, tabs, buttons, and other components drawn by KDE's Qt user interface toolkit. For Java applications, changing the theme should set colors in Java's java.awt.SystemColor objects, which applications may use to customize their user interfaces to match the current theme. Unfortunately, there are some problems here.
This article discusses SystemColor problems with KDE, and provides color swatches, RGB/HSV values, and downloadable color lists for the default SystemColors on Linux.
Table of Contents
This article is part of a series on How to use SystemColors to access OS user interface theme colors that catalogs Java's SystemColors for user interface themes in major OSes. The color catalogs provide a resource for comparing theme colors and creating custom Java components that match the themes.
Accessing KDE theme colors from Java
A KDE theme defines the color scheme and style for window frames, buttons, and so on. Each Linux distribution comes with a starter set of themes. Additional themes can be downloaded from KDE-Look.org, including many that mimic the appearance of Mac, Windows, and Gnome themes.
In principal, Java's java.awt.SystemColor class provides access to theme colors, such as the foreground and background colors for buttons, text fields, and menus. Each theme color has a static SystemColor object. For instance, SystemColor.textHighlight is the background color for selected text in a text field. Unfortunately, Java's GTK foundation clashes with KDE's Qt foundation and causes problems with Java access to theme colors.
A list of SystemColor objects and their use is discussed further in the lead series article. The following article discusses rather substantial KDE-specific issues and provides color swatches and RGB values for the default SystemColors.
Selecting KDE themes
Briefly, KDE themes are controlled from the extensive Appearance page of the Configure Desktop control panel. The theme used for these screenshots is OpenSUSE's default Oxygen theme.
![]() |
| Figure 1. Button style selections in the KDE Style page of the Appearance control panel. |
Button, tab, scrollbar, and other component styles are selected using the Style tab. The Windows tab selects among window frame styles, the Colors tab selects between color schemes, the Icons tab selects icon sets, and the Fonts tab selects fonts. All of these control panels have more of their own tabs and control panels to tweak everything from button sizes to window drop shadow offsets.
![]() |
| Figure 2. Window style selections in the KDE Windows page of the Appearance control panel. |
![]() |
| Figure 3. Color selections in the KDE Colors page of the Appearance control panel. |
Dealing with KDE SystemColor problems
Java's SystemColor class is a flawed approach to accessing OS theme settings. While colors are defined for button backgrounds and text, none are defined for tabs, checkboxes, radio buttons, progress bars, and more. Though a highlight color is defined for selected text, none are defined for selected menu items, toggle buttons, radio buttons, or checkboxes. Beyond colors, Java has no access to OS theme fonts, button styles, window title bar buttons, and so forth. So, while there are specific problems on Linux (and every OS), the primary problem is that Java's theme access is flawed.
Java's user interface class libraries (java.awt and javax.swing) are implemented by Linux Java distributions such as Oracle's JDK, Oracle's JRocket, IBM's JDK, and the open source OpenJDK and Apache Harmony. On Linux, all of these are built atop the GTK+ user interface toolkit.
There are two big problems here:
- Java's user interface is drawn by GTK+ and not by KDE's Qt toolkit.
- Java's use of GTK+ is broken anyway.
All of the KDE theme control panels adjust settings for applications built using Qt. But Java uses GTK+ instead, so none of KDE's theme settings have any effect on Java applications... or any other GTK+ applications. There are so many Linux GTK+ applications (such as those designed to work with Gnome), that KDE provides a separate control panel for basic GTK+ theme control. These settings do affect Java applications.
![]() |
| Figure 4. GTK theme selections in the KDE GTK page of the Appearance control panel. |
However... none of GTK+'s theme settings initialize Java's SystemColors anyway. The SystemColor feature is simply broken. This is a known bug in Java, but it has gone unfixed for years.
Instead, on Linux the SystemColors are initialized to generic defaults that have nothing to do with the current KDE or Gnome theme, and they don't change when the theme is changed. Worse, the generic defaults depend upon the Java distribution in use. Oracle's JDK, Oracle's JRocket, IBM's JDK, and the OpenJDK all initialize the colors one way. Apache's Harmony initializes them another way.
There is a partial work-around. On Linux, the UIDefaults for the native "GTK+" look and feel are set to the proper Gnome theme values, and they update as the theme is changed. These look and feel defaults can be accessed whether or not the Java application uses the look and feel.
However, because Java uses GTK+, and not Qt, there is no native Qt look and feel and no way for a Java application to get any of the KDE theme settings. The best you can do is use the GTK+ theme settings from Gnome.
Color swatches and values
While the problems in the SystemColor implementation insure that the class has almost no use on Linux, the color swatches below nevertheless show the initialized (wrong) defaults for several Java distributions.
Oracle JDK, Oracle JRocket, OpenJDK, and IBM JDK
Oracle's JDK is the gold standard for Java implementations. OpenJDK is nearly the same, with Oracle's proprietary code removed. Oracle's older JRocket and IBM's JDK track these closely and initialize the SystemColors identically (and incorrectly).
| Name | Hex triplet | Red | Green | Blue | Hue | Satur. | Value |
|---|---|---|---|---|---|---|---|
| activeCaption | #000080 | 0 | 0 | 128 | 240 | 100 | 50 |
| activeCaptionBorder | #c0c0c0 | 192 | 192 | 192 | 0 | 0 | 75 |
| activeCaptionText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| control | #dfdfdf | 223 | 223 | 223 | 0 | 0 | 87 |
| controlDkShadow | #4a4a4a | 74 | 74 | 74 | 0 | 0 | 29 |
| controlHighlight | #e6e6e6 | 230 | 230 | 230 | 0 | 0 | 90 |
| controlLtHighlight | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| controlShadow | #6b6b6b | 107 | 107 | 107 | 0 | 0 | 41 |
| controlText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| desktop | #005c5c | 0 | 92 | 92 | 180 | 100 | 36 |
| inactiveCaption | #808080 | 128 | 128 | 128 | 0 | 0 | 50 |
| inactiveCaptionBorder | #c0c0c0 | 192 | 192 | 192 | 0 | 0 | 75 |
| inactiveCaptionText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| info | #e0e000 | 224 | 224 | 0 | 60 | 100 | 87 |
| infoText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| menu | #c4c4c4 | 196 | 196 | 196 | 0 | 0 | 76 |
| menuText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| scrollbar | #c4c4c4 | 196 | 196 | 196 | 0 | 0 | 76 |
| text | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| textHighlight | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| textHighlightText | #c4c4c4 | 196 | 196 | 196 | 0 | 0 | 76 |
| textInactiveText | #808080 | 128 | 128 | 128 | 0 | 0 | 50 |
| textText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| window | #dfdfdf | 223 | 223 | 223 | 0 | 0 | 87 |
| windowBorder | #c4c4c4 | 196 | 196 | 196 | 0 | 0 | 76 |
| windowText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
Apache Harmony
Apache's Harmony is an independent full implementation of Java. While it uses different, and more esthetically appealing SystemColor defaults, those defaults are still wrong and don't track the OS theme.
| Name | Hex triplet | Red | Green | Blue | Hue | Satur. | Value |
|---|---|---|---|---|---|---|---|
| activeCaption | #336699 | 51 | 102 | 153 | 209 | 66 | 60 |
| activeCaptionBorder | #cccccc | 204 | 204 | 204 | 0 | 0 | 80 |
| activeCaptionText | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| control | #dddddd | 221 | 221 | 221 | 0 | 0 | 86 |
| controlDkShadow | #777777 | 119 | 119 | 119 | 0 | 0 | 46 |
| controlHighlight | #eeeeee | 238 | 238 | 238 | 0 | 0 | 93 |
| controlLtHighlight | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| controlShadow | #999999 | 153 | 153 | 153 | 0 | 0 | 60 |
| controlText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| desktop | #224466 | 34 | 68 | 102 | 210 | 66 | 40 |
| inactiveCaption | #888888 | 136 | 136 | 136 | 0 | 0 | 53 |
| inactiveCaptionBorder | #cccccc | 204 | 204 | 204 | 0 | 0 | 80 |
| inactiveCaptionText | #dddddd | 221 | 221 | 221 | 0 | 0 | 86 |
| info | #eeeeee | 238 | 238 | 238 | 0 | 0 | 93 |
| infoText | #222222 | 34 | 34 | 34 | 0 | 0 | 13 |
| menu | #dddddd | 221 | 221 | 221 | 0 | 0 | 86 |
| menuText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| scrollbar | #cccccc | 204 | 204 | 204 | 0 | 0 | 80 |
| text | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| textHighlight | #336699 | 51 | 102 | 153 | 209 | 66 | 60 |
| textHighlightText | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| textInactiveText | #dddddd | 221 | 221 | 221 | 0 | 0 | 86 |
| textText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| window | #ffffff | 255 | 255 | 255 | 0 | 0 | 100 |
| windowBorder | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
| windowText | #000000 | 0 | 0 | 0 | 0 | 0 | 0 |
Downloads
Each Java implementation's default SystemColor set is available as a download in the X11 rgb.txt file format:
- Oracle JDK, Oracle JRocket, OpenJDK, and IBM JDK:
- Apache Harmony:
Further reading
Related articles at NadeauSoftware.com
- Java tip: How to use SystemColors to access OS user interface theme colors is the parent article for this series on
SystemColoruse for the major OSes. - Java tip: SystemColors for Linux Gnome user interface themes discusses accessing theme colors on Linux systems using the Gnome user interface.
Web articles
- Color-Name Dictionaries. Aubrey Jaffer's article goes into great depth on different standard color name lists and includes X11 rgb.txt format files for many of them.
- X11 color names. Wikipedia's article discusses the standard X11 window system "rgb.txt" colors that form the basis of the W3C's list of standard colors for HTML and CSS. The article lists the color names and RGB and HSV colors. The X11 rgb.txt file is available for download from XFree86's CVS archive.





Comments
Post new comment