rainer
rainer

Reputation: 3411

Codename One CSS Material Icon color not changing

I have created an application to test the new CN1 CSS support.

The plugin is great and everything works fine and out-of-the-box, except that the material icon on a button does not change its color with the button's text color. It just stays always the same (black) color.

Before using the CSS support, I changed the theme editor's default foreground color setting to reach the material icon, but now the theme editor seems to be dis-attached from the styling and it does not have any effect anymore.

Is there a UIID for the icon or any other way to change the color of the material icon?

Here is my code:

    FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_CHECK, "TitleCommand", 3);        
    Button buttonTest = new Button("Test css");
    buttonTest.setUIID("ButtonTest");        
    buttonTest.setIcon(icon);

And the CSS:

    ButtonTest {
        color: red;
    }

Upvotes: 1

Views: 142

Answers (2)

rainer
rainer

Reputation: 3411

Just to post a complete answer that might be able to guide someone:

Style style = new Style();
style.setBgColor(ColorUtil.GREEN);
style.setFgColor(ColorUtil.WHITE);
style.setBgTransparency(255);

FontImage imageBack = FontImage.createMaterial(FontImage.MATERIAL_NEXT_WEEK, style);

Upvotes: 0

tizbn
tizbn

Reputation: 1907

try it

FontImage img = FontImage.createMaterial(FontImage.MATERIAL_THUMB_UP, style);

Upvotes: 2

Related Questions