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

Feat: Add Opacity Classes #26

Closed
NickDJM opened this issue Jan 28, 2019 · 0 comments · Fixed by #34
Closed

Feat: Add Opacity Classes #26

NickDJM opened this issue Jan 28, 2019 · 0 comments · Fixed by #34
Labels
enhancement New feature or request

Comments

@NickDJM
Copy link
Collaborator

NickDJM commented Jan 28, 2019

Some times we need to change the opacity of objects. Having a class for this would be super convenient.

Solution

Have a classes like width is in base bootstrap where we would just use .o-25, .o-50, etc.

We can use opacity: x for all modern browsers and filter: alpha(opacity=x) for IE 8 and below.

Mixin

@mixin opacity-variant ($parent, $value) {
  $percent: $value / 100;

  #{$parent}-#{$value} {
    opacity: $percent;
    filter: alpha(opacity=$value);
  }
}

Utility

@include opacity-variant('.o', 0);
@include opacity-variant('.o', 25);
@include opacity-variant('.o', 50);
@include opacity-variant('.o', 75);
@include opacity-variant('.o', 100);

Alternatives

Fully spell out the class to be more descriptive: .opacity-25

@NickDJM NickDJM added the enhancement New feature or request label Jan 28, 2019
@NickDJM NickDJM mentioned this issue Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant