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

Using primary/accent colors at different levels #9064

Closed
pelotom opened this issue Nov 9, 2017 · 3 comments
Closed

Using primary/accent colors at different levels #9064

pelotom opened this issue Nov 9, 2017 · 3 comments
Labels
new feature New feature or request
Milestone

Comments

@pelotom
Copy link
Member

pelotom commented Nov 9, 2017

Several components have a color prop on them, which can be 'inherit' | 'primary' | 'accent' | 'default'. This works fine out of the box most of the time, but when dealing with primary or accent there's also the possibility of wanting to use a particular level (50, 100, 200, etc.) As I understand it, the standard way to do this currently is something like

const colorIndex = 200;

const MyComponent = withStyles(theme => ({
  colorAccent: {
    backgroundColor: theme.palette.secondary[colorIndex],
    color: theme.palette.getContrastText(theme.palette.secondary[colorIndex]),
  },
})(({ classes }) =>
  <AppBar position="static" color="accent" classes={classes}>
    ...
  </AppBar>
);

This obviously offers unlimited power, but for something I find myself wanting to do with some regularity it's not very convenient. It'd be nice if this could be accomplished by something as simple as

const MyComponent = () => (
  <AppBar position="static" color="accent" colorIndex={200}>
    ...
  </AppBar>
);

It seems like this might require #7633 to implement practically.

@oliviertassinari
Copy link
Member

It's also related to #8717.

@yzorg
Copy link

yzorg commented May 1, 2018

@pelotom Was this resolved by #9794?

@pelotom
Copy link
Member Author

pelotom commented May 1, 2018

@yzorg yep, I’d say so

@pelotom pelotom closed this as completed May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants