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(color-modes): Add configuration option for printing color mode #1267

Merged
merged 2 commits into from
Nov 18, 2020

Conversation

lachlanjc
Copy link
Member

Closes #1144, adding a configuration option printColorModeName for setting a color mode to be used in @media (print) (so users don’t print out in dark mode). By using the media query & custom properties, there’s no client-side JavaScript event listeners, so it should work even on a static-exported site.

PR includes updated TypeScript type, documentation, & two tests.

@lachlanjc
Copy link
Member Author

Looks like the failing tests are unrelated to the changes & have been failing since at least #1249 :/

@hasparus
Copy link
Member

Brilliant

@hasparus hasparus merged commit a9c8e5b into system-ui:master Nov 18, 2020
@hasparus
Copy link
Member

Looks like the failing tests are unrelated to the changes & have been failing since at least #1249 :/

Yup, it seems we broke it while fixing the docs build, I'll handle it.

printColorModeName === initialColorModeName
? colors
: modes[printColorModeName]
styles['@media (print)'] = objectToVars('colors', mode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lachlanjc shouldn't this be @media print? (without parens) I just noticed it doesn't work on Brave/Linux.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're totally right. I always forget about that since it's the only media query I use without parentheses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request for configuration option for color mode on printing
2 participants