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

Provide a theming solution for apps consuming material #123

Closed
jelbourn opened this issue Feb 27, 2016 · 13 comments
Closed

Provide a theming solution for apps consuming material #123

jelbourn opened this issue Feb 27, 2016 · 13 comments
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix
Milestone

Comments

@jelbourn
Copy link
Member

jelbourn commented Feb 27, 2016

Needs design doc

@jelbourn jelbourn added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Feb 27, 2016
@jelbourn jelbourn added this to the before beta milestone Feb 27, 2016
@zoechi
Copy link

zoechi commented Feb 27, 2016

angular/angular#2567

@jelbourn jelbourn changed the title Use CSS variables for theming Provide a theming solution for apps consuming material Jun 21, 2016
@francisoud
Copy link

francisoud commented Jul 13, 2016

@jelbourn about your comment #123 (comment) what do you mean by Needs design doc ?
As an end user, I would expect theming to work kind of angular1

I would expect something like this code in a app/main.ts since it's a central part of the application:

import { bootstrap }      from '@angular/platform-browser-dynamic';
import { mdThemingProvider } from '@angular2-material/core';

import { AppComponent }         from './app.component';
import { appRouterProviders }   from './app.routes';

bootstrap(AppComponent, [
  appRouterProviders,
  mdThemingProvider
]);

but in this case I don't know where to put this kind of code

mdThemingProvider.theme('default')
    .primaryPalette('pink')
    .accentPalette('orange');

so may be another solution it to have main.ts delegate to another provider like this:

import { bootstrap }      from '@angular/platform-browser-dynamic';

import { AppComponent }         from './app.component';
import { appRouterProviders }   from './app.routes';
import { appThemingProvider }   from './app.theme';

bootstrap(AppComponent, [
  appRouterProviders,
  appThemingProvider
]);

and a app.theme.tswith:

import { theme } from '@angular2-material/core';

export const appThemingProvider = [
    theme('default')
        .primaryPalette('pink')
        .accentPalette('orange');
];

a alternative would be to reproduce what is done in the router doc
app.theme.ts

import { provideTheme, ThemingConfig } from '@angular2-material/core';

const themes: ThemingConfig = [
  { id: 'default', primaryPalette: 'pink',  accentPalette: 'orange'},
  { ... },
  { ... }
];

export const appRouterProviders = [
  provideTheme(themes);
];

@jelbourn
Copy link
Member Author

The primary way of theming for material2 will be static. The run-time generation of styles is not suitable for most apps because it is rather expensive. That said, we will possibly also have an optional run-time configuration as well.

@davidreher
Copy link

maybe it is a stupid question, but can theming be done today at all?

@jelbourn
Copy link
Member Author

Not easily until we finish implementing user-facing theming.

@a5hik
Copy link

a5hik commented Jul 24, 2016

Looking forward for this feature!

@mehran9
Copy link

mehran9 commented Jul 25, 2016

Same here!

@zakdances
Copy link

It doesn't seem like scss is supported at all right now because components such as sidenav try to import scss with paths like @import 'default-theme'; which doesn't exist because it's from other components.

@code-tree
Copy link
Contributor

Thanks for continuing to work on this. I'm not sure if the following is planning on being supported, so I'm mentioning it just in case:

I plan on including a "dark/light theme" setting in my app. I'm hoping I'll be able to export both normal/dark material theme variations, with the dark version only enabled when body.dark class is present (set by the UI setting). Will this sort of thing be possible in future?

@jelbourn
Copy link
Member Author

jelbourn commented Sep 9, 2016

Current status: we're trying out a couple of different designs on this now, trying to gauge what works best.

@a5hik
Copy link

a5hik commented Sep 22, 2016

@jelbourn Great! waiting for this to be released!

@jelbourn
Copy link
Member Author

Closed by #1239, will be in the next release.

andrewseguin pushed a commit to andrewseguin/components that referenced this issue Oct 15, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix
Projects
None yet
Development

No branches or pull requests

8 participants