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

Implemented color-scheme mix-ins #29552

Closed
wants to merge 6 commits into from

Conversation

josephgeis
Copy link

Closes #29551

Adds two new mix-ins dark-scheme and light-scheme that take a block and wrap them in a media query for prefers-color-scheme.

@josephgeis josephgeis requested a review from a team as a code owner October 19, 2019 22:20
@josephgeis josephgeis mentioned this pull request Oct 19, 2019
8 tasks
@MartijnCuppens
Copy link
Member

I'm ok with this. Would add two more things:

@josephgeis
Copy link
Author

josephgeis commented Oct 20, 2019 via email

@MartijnCuppens
Copy link
Member

Hi @juniorRubyist,

Could you have a look at updating the docs?

@ysds
Copy link
Member

ysds commented Dec 1, 2019

I'm not very interested in this. This is a just shorthand of the same fixed phrase no matter who writes. Your request is the same as adding like follows:

@mixin reduce-motion {
  @media (prefers-reduced-motion: reduce) {
    @content;
  }
}

@mixin print {
  @media print {
    @content;
  }
}

@josephgeis
Copy link
Author

@ysds I think that a shorthand for this would make the code cleaner and create less mistakes. (That second example is just flat out redundant.) If you think about it, you have a mixin for the breakpoints. media-breakpoint-up(md) beats having to write @media (min-width: map-get($grid-breakpoints, md)).

@josephgeis
Copy link
Author

@MartijnCuppens Sorry bout that. I pushed changes to the docs.

@MartijnCuppens
Copy link
Member

If you think about it, you have a mixin for the breakpoints. media-breakpoint-up(md) beats having to write @media (min-width: map-get($grid-breakpoints, md))

We use these mixins quite a lot in our codebase, and we also have media-breakpoint-down() media-breakpoint-between() mixins which are a little more complex, so it makes sense to have the up variant.

I think I'm gonna agree with @ysds here, we got to watch out we don't add too many mixins we don't use ourselves.

@mdo mdo mentioned this pull request Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dark/Light Mode Mixins
4 participants