Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors in attrs.xml too #5

Open
StefMa opened this issue Jan 27, 2016 · 3 comments
Open

Colors in attrs.xml too #5

StefMa opened this issue Jan 27, 2016 · 3 comments

Comments

@StefMa
Copy link
Contributor

StefMa commented Jan 27, 2016

I'm very confused why the colors are handled over the colors.xml file instead like the texts via the attributes file?

We can set it up like this too:

    <declare-styleable name="MaterialLoginView">
        <attr name="loginTitle" format="string" />
        <attr name="loginHint" format="string" />
        <attr name="loginPasswordHint" format="string" />
        <attr name="loginActionText" format="string" />
        <attr name="loginTextColor" format="reference" />

        <attr name="registerTitle" format="string" />
        <attr name="registerHint" format="string" />
        <attr name="registerPasswordHint" format="string" />
        <attr name="registerRepeatPasswordHint" format="string" />
        <attr name="registerActionText" format="string" />
        <attr name="registerTextColor" format="reference" />
        <attr name="registerIcon" format="reference" />
    </declare-styleable>

and use it like

        app:loginTextColor="@color/material_login_register_color"

Any opinion not to do this?

@shem8
Copy link
Owner

shem8 commented Jan 27, 2016

Great question, I've struggling it for a few hours how to do it right, even ask on SO.

I can't just pass the color as an attribute to the view because this color is showing up in a couple of places, for example- the "login" color is in the view background, in the text style and in the login button background drawable, so I preferred putting it all in the xml's and not in code (and there are some things that I can event not set up in code, like the hint text style)

@StefMa
Copy link
Contributor Author

StefMa commented Jan 28, 2016

Ok, all right 👆
But would it be better when we create a style like
MaterialLoginThemeLight.ColorScheme and MaterialLoginThemeDark.ColorScheme to override the colors in styles.xml?

@shem8
Copy link
Owner

shem8 commented Jan 28, 2016

So the user will be able to inheritance from those styles? If so- we'll need to create also LightDarkActionBar or more for some custom styles, am I right?
Isn't it better just use the color like we do now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants