Modify

Opened 4 years ago

Last modified 3 years 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 4 years ago.
upload_dark_mode.png (28.7 KB ) - added by Klumbumbus 4 years ago.
josm_new_mail_info.png (8.2 KB ) - added by skyper 4 years ago.
screenshot of info box
josm_history_dark_mode.png (86.0 KB ) - added by skyper 4 years ago.
screenshot of history viewer in dark mode
JOSM-statusbar-foreground-fix.diff (2.2 KB ) - added by DevCharly 4 years ago.
fix text color in status bar
JOSM-FlatLaf-blue-links-fix (3.5 KB ) - added by DevCharly 4 years ago.
fix blue links
JOSM-FlatLaf-blue-links-fix.diff (3.8 KB ) - added by DevCharly 4 years ago.
fix blue links (updated to use ColorHelper.color2html())
JOSM-NamedColor-from-Laf.diff (1.5 KB ) - added by DevCharly 4 years 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 4 years ago.
FlatLaf plugin: define some named colors for validation, status bar, etc
upload_dark_mode_fixed.png (57.5 KB ) - added by DevCharly 4 years ago.
JOSM-FlatLaf-validation-border.diff (1.4 KB ) - added by DevCharly 3 years ago.
fix combobox validation borders
FlatLaf-validation-border.png (105.0 KB ) - added by DevCharly 3 years ago.
OSM-FlatLaf-plugin-outline.diff (5.7 KB ) - added by DevCharly 3 years ago.

Download all attachments as: .zip

Change History (59)

by Klumbumbus, 4 years ago

Attachment: check_boxes_dark_mode.png added

by Klumbumbus, 4 years ago

Attachment: upload_dark_mode.png added

comment:1 by Klumbumbus, 4 years ago

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

comment:2 by Klumbumbus, 4 years ago

Keywords: dark mode added

by skyper, 4 years ago

Attachment: josm_new_mail_info.png added

screenshot of info box

by skyper, 4 years ago

Attachment: josm_history_dark_mode.png added

screenshot of history viewer in dark mode

comment:3 by skyper, 4 years ago

Description: modified (diff)

add more color issues

comment:4 by skyper, 4 years ago

Keywords: color added

comment:5 by Klumbumbus, 4 years ago

In 17043/josm:

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

by DevCharly, 4 years ago

fix text color in status bar

comment:6 by DevCharly, 4 years ago

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 4 years ago by DevCharly (previous) (diff)

comment:7 by DevCharly, 4 years ago

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 4 years ago by DevCharly (previous) (diff)

by DevCharly, 4 years ago

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

fix blue links

by DevCharly, 4 years ago

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

by DevCharly, 4 years ago

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

by DevCharly, 4 years ago

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

by DevCharly, 4 years ago

Attachment: upload_dark_mode_fixed.png added

comment:8 by DevCharly, 4 years ago

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 by Klumbumbus, 4 years ago

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

Thx for the patches.

in reply to:  9 comment:10 by skyper, 4 years ago

Replying to Klumbumbus:

Thx for the patches.

Any problems? Can the patches be applied?

comment:11 by simon04, 4 years ago

In 17116/josm:

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

comment:12 by simon04, 4 years ago

In 17117/josm:

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

comment:13 by simon04, 4 years ago

In 17118/josm:

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

comment:14 by simon04, 4 years ago

In 17119/josm:

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

comment:15 by simon04, 4 years ago

Resolution: fixed
Status: newclosed

In 35572/osm:

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

comment:16 by simon04, 4 years ago

DevCharly, thank you for the patches – highly appreciated!

comment:17 by Klumbumbus, 4 years ago

Description: modified (diff)

in reply to:  8 comment:18 by skyper, 4 years ago

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 by skyper, 4 years ago

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 4 years ago by skyper (previous) (diff)

in reply to:  19 ; comment:20 by DevCharly, 4 years ago

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.

in reply to:  20 comment:21 by skyper, 4 years ago

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 by simon04, 3 years ago

In 17299/josm:

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

by DevCharly, 3 years ago

fix combobox validation borders

by DevCharly, 3 years ago

comment:23 by DevCharly, 3 years ago

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.


Version 0, edited 3 years ago by DevCharly (next)

comment:24 by stoecker, 3 years ago

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

by DevCharly, 3 years ago

comment:25 by DevCharly, 3 years ago

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 by skyper, 3 years ago

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.

in reply to:  26 ; comment:27 by DevCharly, 3 years ago

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...

in reply to:  27 ; comment:28 by Klumbumbus, 3 years ago

Dirk?

Replying to DevCharly:

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

in reply to:  28 comment:29 by stoecker, 3 years ago

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 by DevCharly, 3 years ago

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 by skyper, 3 years ago

@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 by DevCharly, 3 years ago

@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 by skyper, 3 years ago

I am sorry for my impatience.

comment:34 by DevCharly, 3 years ago

In 35699/osm:

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

comment:35 by DevCharly, 3 years ago

In 35700/osm:

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

comment:36 by DevCharly, 3 years ago

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 by DevCharly, 3 years ago

In 35702/osm:

see #19819 - dist flatlaf.jar

comment:38 by DevCharly, 3 years ago

@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 by DevCharly, 3 years ago

In 35703/osm:

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

comment:40 by DevCharly, 3 years ago

In 35704/osm:

see #19819 - dist flatlaf.jar

comment:41 by DevCharly, 3 years ago

Ticket for classloader problem is here: #20456

in reply to:  41 comment:42 by skyper, 3 years ago

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 by skyper, 3 years ago

Description: modified (diff)

comment:44 by skyper, 3 years ago

Description: modified (diff)

comment:45 by skyper, 3 years ago

Description: modified (diff)

comment:46 by simon04, 3 years ago

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. Next status will be 'closed'.
to The owner will be changed from DevCharly to the specified user.
Next status will be 'needinfo'. The owner will be changed from DevCharly to Klumbumbus.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from DevCharly to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.