Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Alpha values of colors in themes are incorrectly serialized and deserialized
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=200&t=56813
Page 1 of 1

Author:  Peto [ Wed 07 Nov, 2018, 18:34 ]
Post subject:  Alpha values of colors in themes are incorrectly serialized and deserialized

Hi,

I'd like to report bug. Alpha values of colors in themes are incorrectly serialized and deserialized to/from JForex\Workspaces\DEMO\ID\JForex.xml file.

I want to use HeikinAshi indicator and hide normal candles. To do that I want to set alpha value of candles to 0. When I set color of "Bull candle" in Themes settings of Master instrument | Candles to RGBA(0, 0, 0, 1)
this color is serialized in the file as <entry key="CANDLE_BULL" value="1000000"/>
and it works fine until I close JForex and reopen it again.

I did some testing and it seems that as long as there are 2 characters per each color component serialized, color is correctly deserialized and set in JForex.
For instance, if I set color to RGBA(0, 0, 0, 16), it is serialized as "10000000" and deserialized correctly.
If I set color to RGBA(0, 0, 0, 1), it is serialized as "1000000" (only 7 characters, 1 character "0" for alpha value is missing) and deserialized incorrectly to alpha value 255.
If I manually rewrite "1000000" to "01000000" (added missing leading 0), it is correctly deserialized to alpha value 1.

My guess is that when you are parsing values from xml you expect 2 hex characters for each color component and if there is only 1, you fallback to default value 255.
Please fix this, it is really annoying because every time I close JForex, it resaves entire JForex.xml and changes all colors, so manually fixing it does not help.

thanks

Author:  API Support [ Fri 09 Nov, 2018, 15:13 ]
Post subject:  Re: Alpha values of colors in themes are incorrectly serialized and deserialized

Problem was fixed in new platform version.

  Page 1 of 1