GwtMaterialDesign / gwt-material

A Google Material Design wrapper for GWT
https://gwtmaterialdesign.github.io/gmd-core-demo/
Apache License 2.0
410 stars 124 forks source link

MaterialSpinner, Material Loader - Support custom colors #896

Open jswart opened 5 years ago

jswart commented 5 years ago

The MaterialSpinner class does not allow you to directly setColor(String) where String can be any hex color code. It would be great if this were functionality was provided instead of having to use the limited SpinnerColor enumerated constants.

A custom MaterialLoader should also allow you to setColor(String) in the same manner.

kevin-i3 commented 5 years ago

The spinner color is only limited that's why we used only Materialize colors. The only thing that you can workaround as of now is to override thru css file.

    BLUE("spinner-blue"),
    BLUE_ONLY("spinner-blue-only"),
    RED("spinner-red"),
    RED_ONLY("spinner-red-only"),
    YELLOW("spinner-yellow"),
    YELLOW_ONLY("spinner-yellow-only"),
    GREEN("spinner-green"),
    GREEN_ONLY("spinner-green-only");
jswart commented 5 years ago

Why do you limit to materialize colors though? Maybe it could be more useful to let people change to any color code, so that they can properly brand their material app.

While an enum is useful for showing and selecting a single item from a set of colors quickly, it becomes more difficult to override it unless I go through the CSS like you suggested.

In order for a web component like this one to be more reusable, I should be able to set it to any color code from my CSSResources file.

kevin-i3 commented 5 years ago

That is an internal implementation of Materialize, but we can update it to have a custom color implementation. I will add this TODO in next release.

jswart commented 5 years ago

So I just want to add that I am not familiar with the Materialize spec. Does that spec say "these are the only colors that are provided"? Is there a specific part of the spec that prevents the expansion of colors? From my perspective, I figured that https://gwtmaterialdesign.github.io would be able to change color to whatever you wanted if you just added a hex code.

kevzlou7979 commented 5 years ago

This feature request will be added on 2.3 release