YetAnotherConfigLib

YetAnotherConfigLib

13M Downloads

Support for non-AWT colours in ColorController

TheKodeToad opened this issue ยท 4 comments

commented

It's not that great being forced to use java.awt.Color. Maybe just use ints and accept a java.util.Function to convert back and forth a custom class. When using GSON, it causes some reflection exceptions with AWT colours. I did manage to fix this with an extra class, though.

commented

You aren't forced to use java.awt.Color and are free to use whatever you wish. There is a UnaryOperator parameter where you can build on the gson builder to add whatever you wish.

commented

You aren't forced to use java.awt.Color and are free to use whatever you wish. There is a UnaryOperator parameter where you can build on the gson builder to add whatever you wish.

GSON builder? I'm talking about using ColorController. You'd have to reimplement the whole class using int or another colour class.

(please correct me if I'm missing something)

commented

Oh sorry, I thought you were talking about the config API.

commented

After looking into this, it would just be the case of still using java.awt internally to process colours but a different controller implementation to handle that conversion. I think it would just be better if you implemented your own controller that uses ColorControllerElement for the actual GUI.