Modify

Opened 16 months ago

Last modified 9 months ago

#19819 new defect

Issues with dark modes

Reported by: Klumbumbus Owned by: DevCharly
Priority: normal Milestone:
Component: Plugin flatlaf Version:
Keywords: dark mode color Cc: DevCharly

Description (last modified by skyper)

This is a collection of issues with dark mode, especially with FlatLaf Dark, reported before on different places. The reason might be in JOSM core, the FlatLaf plugin or the FlatLaf Laf itself.

Attachments (13)

check_boxes_dark_mode.png (93.1 KB) - added by Klumbumbus 16 months ago.
upload_dark_mode.png (28.7 KB) - added by Klumbumbus 16 months ago.
josm_new_mail_info.png (8.2 KB) - added by skyper 16 months ago.
screenshot of info box
josm_history_dark_mode.png (86.0 KB) - added by skyper 16 months ago.
screenshot of history viewer in dark mode
JOSM-statusbar-foreground-fix.diff (2.2 KB) - added by DevCharly 16 months ago.
fix text color in status bar
JOSM-FlatLaf-blue-links-fix (3.5 KB) - added by DevCharly 16 months ago.
fix blue links
JOSM-FlatLaf-blue-links-fix.diff (3.8 KB) - added by DevCharly 16 months ago.
fix blue links (updated to use ColorHelper.color2html())
JOSM-NamedColor-from-Laf.diff (1.5 KB) - added by DevCharly 16 months ago.
allow class NamedColorProperty to get a default color from the current look and feel
OSM-FlatLaf-plugin-NamedColors.diff (2.7 KB) - added by DevCharly 16 months ago.
FlatLaf plugin: define some named colors for validation, status bar, etc
upload_dark_mode_fixed.png (57.5 KB) - added by DevCharly 16 months ago.
JOSM-FlatLaf-validation-border.diff (1.4 KB) - added by DevCharly 14 months ago.
fix combobox validation borders
FlatLaf-validation-border.png (105.0 KB) - added by DevCharly 14 months ago.
OSM-FlatLaf-plugin-outline.diff (5.7 KB) - added by DevCharly 14 months ago.

Download all attachments as: .zip

Change History (59)

Changed 16 months ago by Klumbumbus

Attachment: check_boxes_dark_mode.png added

Changed 16 months ago by Klumbumbus

Attachment: upload_dark_mode.png added

comment:1 Changed 16 months ago by Klumbumbus

Ticket #19785 has been marked as a duplicate of this ticket.

comment:2 Changed 16 months ago by Klumbumbus

Keywords: dark mode added

Changed 16 months ago by skyper

Attachment: josm_new_mail_info.png added

screenshot of info box

Changed 16 months ago by skyper

Attachment: josm_history_dark_mode.png added

screenshot of history viewer in dark mode

comment:3 Changed 16 months ago by skyper

Description: modified (diff)

add more color issues

comment:4 Changed 16 months ago by skyper

Keywords: color added

comment:5 Changed 16 months ago by Klumbumbus

In 17043/josm:

see #19819 - Make the toolbar preferences icon work better for different look and feels

Changed 16 months ago by DevCharly

fix text color in status bar

comment:6 Changed 16 months ago by DevCharly

I've attached a patch to fix the text color in the status bar: attachment:JOSM-statusbar-foreground-fix.diff

There are actually two issues:

  1. there are background and foreground colors for status bar defined in "Preferences > Display settings > Colors", but only background color is used
  2. when changing those colors in Preferences dialog, the status bar colors are not updated because checking for a wrong key prefix
Last edited 16 months ago by DevCharly (previous) (diff)

comment:7 Changed 16 months ago by DevCharly

I've attached a patch that fixes the blue links in various dialogs and in help browser.
attachment:JOSM-FlatLaf-blue-links-fix.diff

The solution is to use UIManager.getColor("Component.linkColor") to get a link color from the current look and feel.
If not available, use the default color (blue).

Last edited 16 months ago by DevCharly (previous) (diff)

Changed 16 months ago by DevCharly

Attachment: JOSM-FlatLaf-blue-links-fix added

fix blue links

Changed 16 months ago by DevCharly

fix blue links (updated to use ColorHelper.color2html())

Changed 16 months ago by DevCharly

allow class NamedColorProperty to get a default color from the current look and feel

Changed 16 months ago by DevCharly

FlatLaf plugin: define some named colors for validation, status bar, etc

Changed 16 months ago by DevCharly

Attachment: upload_dark_mode_fixed.png added

comment:8 Changed 16 months ago by DevCharly

I've attached two patches that support dark (LaF provided) default colors for named colors.
attachment:JOSM-NamedColor-from-Laf.diff
attachment:OSM-FlatLaf-plugin-NamedColors.diff

JOSM "named colors" use class NamedColorProperty and have hard coded default color for light LaFs.
They can be changed in "Preferences > Display settings > Colors".
There is no way to have different colors for light and dark LaFs in class NamedColorProperty.

So the idea to solve this simply is to first ask the Laf (with UIManager.getColor(key)) for a default color.
If the Laf does not provide on, use the hard coded default color.
This is what attachment:JOSM-NamedColor-from-Laf.diff does.

Second part it to define dark colors in FlatLaf plugin: attachment:OSM-FlatLaf-plugin-NamedColors.diff

It works good, but maybe you core developers have a better idea/solution?

I've added a few colors for validation, status bar and imagery. This fixes the "Upload" dialog, makes the status bar darker and fixes the too bright green in tables in "Preferences > Imagery preferences > Imagery providers" dialog.


The screenshot shows also fixed link colors from patch attachment:JOSM-FlatLaf-blue-links-fix.diff

I'll provide a patch for the double borders on some combo boxes soon...

comment:9 Changed 16 months ago by Klumbumbus

Summary: Issues with dark modes[patch] Issues with dark modes

Thx for the patches.

comment:10 in reply to:  9 Changed 16 months ago by skyper

Replying to Klumbumbus:

Thx for the patches.

Any problems? Can the patches be applied?

comment:11 Changed 16 months ago by simon04

In 17116/josm:

see #19819 - MapStatus: make color preferences work (patch by DevCharly)

comment:12 Changed 16 months ago by simon04

In 17117/josm:

see #19819 - Obtain link color using UIManager (patch by DevCharly)

comment:13 Changed 16 months ago by simon04

In 17118/josm:

see #19819 - NamedColorProperty: obtain fallback color using UIManager (patch by DevCharly)

comment:14 Changed 16 months ago by simon04

In 17119/josm:

see #19819 - NamedColorProperty: update Javadoc, add unit test

comment:15 Changed 16 months ago by simon04

Resolution: fixed
Status: newclosed

In 35572/osm:

fix #19819 - FlatLaf: specify/override colors (patch by DevCharly)

comment:16 Changed 16 months ago by simon04

DevCharly, thank you for the patches – highly appreciated!

comment:17 Changed 16 months ago by Klumbumbus

Description: modified (diff)

comment:18 in reply to:  8 Changed 16 months ago by skyper

Resolution: fixed
Status: closedreopened

Replying to DevCharly:


I'll provide a patch for the double borders on some combo boxes soon...

Not all issues are fixed, yet.

comment:19 Changed 16 months ago by skyper

I had to disable and then reenable the plugin to get the status bar correct. The upload dialog still did not change at all for me. Do I have to set the correct colors manually?

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-10-09 18:53:24 +0200 (Fri, 09 Oct 2020)
Revision:17137
Build-Date:2020-10-10 01:30:48
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (17137 en) Linux Debian GNU/Linux 10 (buster)
Java version: 11.0.8+10-post-Debian-1deb10u1, Debian, OpenJDK 64-Bit Server VM
Look and Feel: com.formdev.flatlaf.FlatDarculaLaf
Screen: :0.0 1366x768 (scaling 1.0x1.0)
Desktop environment: GNOME
Java package: openjdk-11-jre:amd64-11.0.8+10-1~deb10u1

Plugins:
+ flatlaf (35572)
Last edited 16 months ago by skyper (previous) (diff)

comment:20 in reply to:  19 ; Changed 16 months ago by DevCharly

Replying to skyper:

The upload dialog still did not change at all for me. Do I have to set the correct colors manually?

No, but maybe reset them.

The update dialog uses named colors that you can change in "Preferences > Display Settings > Colors".
Search for "input validation".
If you have changed one of the 5 colors, then reset them.
A restart seems to be necessary too.

comment:21 in reply to:  20 Changed 16 months ago by skyper

Replying to DevCharly:

Replying to skyper:

The upload dialog still did not change at all for me. Do I have to set the correct colors manually?

No, but maybe reset them.

The update dialog uses named colors that you can change in "Preferences > Display Settings > Colors".
Search for "input validation".
If you have changed one of the 5 colors, then reset them.
A restart seems to be necessary too.

I had not changed the preferences.
I played around with the settings and the change of Input validation: warning does not do anything. Input validation: warning background and Input validation:valid work.

It would be nice to get the dialog about "needed restart" if you change the colors.

comment:22 Changed 15 months ago by simon04

In 17299/josm:

see #19819 - Obtain link color using UIManager (default to JOSM blue)

Changed 14 months ago by DevCharly

fix combobox validation borders

Changed 14 months ago by DevCharly

comment:23 Changed 14 months ago by DevCharly

I've attached another patch that fixes the double combobox borders and missing background when using validation:
attachment:JOSM-FlatLaf-validation-border.diff

The reason for the double border was that the combobox has a border and additionally JOSM assigns another line border to the text field within the combobox.

FlatLaf supports border coloring out-of-the-box via client property. Setting text field border is not necessary.
See https://github.com/JFormDesigner/FlatLaf/releases/tag/0.35

The validation background assigned by JOSM to the text field was not painted because the field is not opaque.
Solution is to assign the background color to the combobox.


Last edited 14 months ago by skyper (previous) (diff)

comment:24 Changed 14 months ago by stoecker

That's no proper patch. JOSM code must not be modified for specific plugins. Find a generic solution instead.

Changed 14 months ago by DevCharly

comment:25 Changed 14 months ago by DevCharly

That's no proper patch. JOSM code must not be modified for specific plugins. Find a generic solution instead.

Yes, I understand that.

I've attached a new patch that only changes the flatlaf plugin: attachment:OSM-FlatLaf-plugin-outline.diff

comment:26 Changed 13 months ago by skyper

Anything wrong with the patch or just forgotten?

@DevCharly
Thanks for your improvements.
I still have to fiddle around with all the background colors for relation manager, history viewer and conflict manager. Are there any chances to ship better default colors for FlatDarkLaf? Many thanks in advance.

comment:27 in reply to:  26 ; Changed 13 months ago by DevCharly

Replying to skyper:

Anything wrong with the patch or just forgotten?

Don't know.
Would it be possible to give me SVN commit access
so that I can update the flatlaf plugin myself?

@DevCharly
I still have to fiddle around with all the background colors for relation manager, history viewer and conflict manager. Are there any chances to ship better default colors for FlatDarkLaf?

I'll have a look...

comment:28 in reply to:  27 ; Changed 12 months ago by Klumbumbus

Dirk?

Replying to DevCharly:

Would it be possible to give me SVN commit access
so that I can update the flatlaf plugin myself?

comment:29 in reply to:  28 Changed 12 months ago by stoecker

Replying to DevCharly:

Would it be possible to give me SVN commit access
so that I can update the flatlaf plugin myself?

Done. Please try.

comment:30 Changed 12 months ago by DevCharly

In 35698/osm:

see #19819 - flatlaf: fix double combobox borders and missing background when using validation

https://josm.openstreetmap.de/ticket/19819#comment:23

comment:31 Changed 12 months ago by skyper

@DevCharly:
I think, you need to add the new plugin .jar file, manually. There is no automatism for the task, so far. ATM, [35679/osm] with [35680/osm] is the latest available version.

comment:32 Changed 12 months ago by DevCharly

@skyper
Thanks for the reminder.
I know.
Just wanted to fix some more colors before building the jar.
Will work on this later today...

comment:33 Changed 12 months ago by skyper

I am sorry for my impatience.

comment:34 Changed 12 months ago by DevCharly

In 35699/osm:

see #19819 - flatlaf: added dark colors for preference tables, conflict solver and history viewer (requires JOSM patch)

comment:35 Changed 12 months ago by DevCharly

In 35700/osm:

see #19819 - flatlaf: enable Java 9+ multi-release JAR (MRJ) for hires disabled icons

comment:36 Changed 12 months ago by DevCharly

In 35701/osm:

see #19819 - flatlaf: increase margin of checkmark background in JCheckBoxMenuItems to make checked menu items better recognizable (e.g. View > Main toolbar, ...)

comment:37 Changed 12 months ago by DevCharly

In 35702/osm:

see #19819 - dist flatlaf.jar

comment:38 Changed 12 months ago by DevCharly

@skyper I've checked in a new build of the flatlaf plugin jar.

It works fine in my development environment (Eclipse)
but not when running pre-built JOSM.

There is a problem with classloaders.
JOSM uses two different classloaders

  • for load plugin and
  • for look and feel initialization

This prevents that FlatLaf finds the .properties files in the plugin.

Tried to workaround this without success.

I'll open a ticket...

comment:39 Changed 12 months ago by DevCharly

In 35703/osm:

see #19819 - flatlaf: fixed missing properties files in dist jar

comment:40 Changed 12 months ago by DevCharly

In 35704/osm:

see #19819 - dist flatlaf.jar

comment:41 Changed 12 months ago by DevCharly

Ticket for classloader problem is here: #20456

comment:42 in reply to:  41 Changed 11 months ago by skyper

Summary: [patch] Issues with dark modesIssues with dark modes

Thanks a lot for the colors.

Replying to DevCharly:

Ticket for classloader problem is here: #20456

Probably, one reason, why I had trouble setting them manually.

comment:43 Changed 11 months ago by skyper

Description: modified (diff)

comment:44 Changed 11 months ago by skyper

Description: modified (diff)

comment:45 Changed 11 months ago by skyper

Description: modified (diff)

comment:46 Changed 9 months ago by simon04

Owner: changed from simon04 to DevCharly
Status: reopenednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain DevCharly.
as The resolution will be set.
to The owner will be changed from DevCharly to the specified user.
The owner will change to Klumbumbus
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from DevCharly to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.