Improve the color comparison
vickipetrova opened this issue · comments
The color comparison works in a hacky way right now and this can be improved.
In the ColorThemeView
to check which color theme is currently selected, the mainColor
and backgroundColors
of the color theme rectangle and the Default variables are compared. However, this didn't work well with the simple ==
operator because Swift interprets them differently for some reason. A little hack to get around this was that Swift compares them as expected when the color is made .lighter()
or .darker()
. So I made at least one of the colors lighter and darker and used the OR operator for the comparison.
This should be solved to use the AND operator. Investigate why the .lighter()
or .darker()
extensions help Swift compare the two colors and improve the colorEquals
function in the ColorThemeView
.