-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Add support for color
attribute to radio
#4039
Conversation
src/lib/radio/_radio-theme.scss
Outdated
.mat-radio-ripple .mat-ripple-element { | ||
background-color: mat-color($warn, 0.26); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling that we could move that into a mixin? So we don't have to repeat code three times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure ;)
I will create a mixin, you're right.
@devversion Added mixin & Default color (accent) |
@rtrompier could you rebase this PR? |
@jelbourn Should be good ;) |
border-color: mat-color($foreground, secondary-text); | ||
} | ||
.mat-radio-button { | ||
//default color (accent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our indentation is +2, not +4
} | ||
.mat-radio-button { | ||
//default color (accent) | ||
&:not(.mat-primary):not(.mat-accent):not(.mat-warn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this :not
expression should be necessary; the radio should just have accent
be the default color.
.mat-radio-ripple .mat-ripple-element { | ||
background-color: mat-color($accent, 0.26); | ||
} | ||
@mixin radio-theme-color($color, $foreground) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mixin is going to generate a lot of css output; only styles that are directly affected by the palette swap should be defined within.
@@ -396,6 +406,9 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy { | |||
/** Whether the ripple effect on click should be disabled. */ | |||
private _disableRipple: boolean; | |||
|
|||
/** Current color. Can be `primary`, `accent`, or `warn`. */ | |||
private _color: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type should use the string literal values
private _color: 'primary' | 'accent' | 'warn';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to use straight color values like for example #00FF00
or rgb(255,100,0)
from HTML ?
@rtrompier Thanks for your work on this PR. It looks like your PR is no longer up-to-date and there isn't any activity here. I'm going to address the color binding for radios in #5068 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I have added an Input COLOR to allow tu user to choose the color like the checkbox component.
The color can be
primary
,accent
, orwarn
.