-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Differntiate inside single theme. #537
Comments
If you use the new theming system in the latest release you can use the SASSs map-get function to retrieve a colour variant for your current colour scheme. There are more details here |
@WillsB3, I know. But that would require me to recompile the sass. I don't mind doing that, but it is something that needs to be available to every MD-user. (as far as I know, the SASS map-get is not available in the browser!) |
Feel free to use different themes on different elements. For example, use md-theme="amber" and set 'md-primary' if you want an amber button. |
That's not what I meant. A theme is meant to style an application. Not to convey meaning. |
+1 for attributes or classes for setting shade, perhaps I've always just set my own classes for highlight colors, but I could see the utility with See also #521 edit: as you say
which is an argument against default highlight colors |
Ok, I'm working toward an (partial) solution on this. If anybody want to pick this up, drop me a note, so we can work together on this. |
@SanderElias Nice. Can you perhaps share your thinking and your planned approach here? |
Sure, I'm largely done, just have to leave in a while, perhaps I can finish up on Monday. you need 2, because a application might switch themes during runtime. |
Isn't step 2 covered by angular-materials built in Please excuse me if I'm getting confused here 👍 |
@WillsB3 No, if you want to have an generic class like I have an working version now. It needs to be hooked up into the ng-material, overthinking what the best way is, to do just that. |
@SanderElias @rschmukler my first thought is:
This fails with nested themes, depending on the order of the CSS rules in the source. Here's a fiddle with this code |
@plato-cambrian That is why I opted for generating an dynamic style-sheet with JavaScript. A small cost when switching themes, none for the rest of the time. |
@SanderElias i believe you should plan for per-element themes as per https://material.angularjs.org/#/Theming/04_how_it_works I don't know if we need to support arbitrary depth nested themes for these convenience classes. The material spec seems to say no. So, working under the assumption that we two nested themes is adequate, I updated the fiddle with a pure CSS solution. (I don't know if the attribute selectors I'm using count as wildcards.) Two nested themes, main and sub, would fulfil your use case - choose your main theme (three primary tints and one secondary) per customer. Set For the record I think that for your use case you should only use one theme, and set the highlight colors with classes. PS if this was scrum we would split this issue into two stories:
|
@Plato, hmm, I have to think it over. your solution would indeed work, but it will generate a lot of extra css It might be a nice solution for the generic classes too. I'll will come back to you!
|
@ryanschmukler and I talked about this yesterday... We think we're going to This will allow a custom theme to potentially have 10+ different colors, if
|
@ajoslin, That sound good! .md-theme.xxx[aria-alert] { Etc.. |
[md-theme="#{$theme-name}"] {
@each $_myColor in map-keys($primary-color-palette) {
&.md-fg-#{$_myColor} { color: map-get($primary-color-palette, $_myColor) }
&.md-bg-#{$_myColor} { background-color: map-get($primary-color-palette, $_myColor) }}
}
After some experimenting, this turned out to be very flaky. I'm not sure if this can be done with an css-only option. However I'm not a crack at css. |
+1 to styling off the aria tags! That's a great idea, it could: On Mon, Nov 10, 2014 at 3:03 AM, Sander Elias notifications@github.com
|
I did created this color-switcher proof of concept that works with an dynamic generated style-sheet. Is something like this, a solution that would be considered for inclusion? I now just generate the colors, but of coarse it can also be used for all additional colors to convey state to the end-user. |
+1 for styling off of ARIA attributes. Thanks for highlighting this issue! |
I am not much of a designer, but styling based on ARIA attributes just seems very wrong to me. I am definitely pro finding ways to increase ARIA awareness and encourage a11y, but this is not the right way (imo). So, it's 👎 from me... (Just to be clear: The -1 is for the specific idea, not the effort people (both from the team and the community) are putting into this, which is plain awesome !) |
@gkalpak thanks for the input! I'm not sure which way we will end up going with it, but the community should never be afraid to express its opinions - ultimately we are trying to build the best framework possible and getting as many thoughts as possible helps us make informed decisions. Thanks again for the thoughts! |
@SanderElias @plato-cambrian @WillsB3 @ThomasBurleson @robertmesserle @marcysutton @ajoslin here is a proposal syntax for theming. Basically, we would use the CSS trick that @SanderElias came up with to provide default palettes via CSS (all of them) and then encourage sticking to a few hues within a palette (as per the material design spec) within a given theme. We use the |
I also agree with @gkalpak I'm all for aria but I don't think it should be used for themes. |
There is also the issue that some ARIA attributes injected by ngAria can be disabled (such as |
JS based theming implemented in 0.7.0 - let us know what you think guys! |
@rschmukler: The theme colors available only within I would expect css rules available which only defines the colors. The same for 400,500,600,700,800,900,A100,A200,A400,A700. The main usecase would be readily available theme colors outside of |
If what @klaszlo is saying is correct, then it would be great to make the necessary changes so it works outside of md elements. |
@rschmukler, as @klaszlo is saying, it only works inside (selected)
This should be colored according to the selected theme! In my tests this does not. |
👍 I need that too :) Edit: don't need any more because I switched to Materialize. Maybe angular-material could integrate Materialize to benefit of all the work done there. |
I am new for Material design. Can anyone explain to me how i will change my default theme to someother. Thanks in advance |
@opraatnitt add |
I'm a little behind here, but I believe that this is the wrong approach. If you want 'functional' colors, such as one to warn users, don't modify the css for the current theme- just apply a 'warning' theme to that particular element. This allows you to pick any hue of your warning theme to ensure your contrast on the page, as well as chose a secondary palette just in case you need some dark warnings and some light. If creating the themes is taking too long, you could create many angularJS material design themes easily using this tool I created before: Cheers! |
I need to build an app that needs to be in one color-scheme. What I mean by this, I can only set the theme once, on the highest level. Inside my app, I need a way to differentiate my elements.
I looked for some styles like this:
md-warn
md-danger
md-primary
md-secondary
md-error
md-success
But I could not find those! Found quite some nice things while reading trough the material css and scss files, but somehow I seemed to have missed out on these!
Als0 it would be nice to have access to the color palette as defined in the design spec. It would be really handy to have things like this:
md-color-50, md-color-100 etc,
where both the color and the background color, would be set as in the color palette.
The text was updated successfully, but these errors were encountered: