Remove overriding colors and backgrounds in media print of Drupal Seven theme print.css

Created on 29 May 2019, over 6 years ago
Updated 8 June 2025, 3 months ago

After several hours of investigating problem with printing backgrounds in Drupal admin pages, I have found the code in core/themes/seven/css/base/print.css file:

@media print {
  * {
    color: #000 !important; /* Black prints faster: h5bp.com/s */
    background-color: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

Why Drupal use so hard rules with !important for reset all colors and background on all admin page elements? Those overrides very hard to find for regular users, and not so easy to override via custom css rules.

As result, regular Drupal users by default have problems with printing colored elements in admin pages,with default Seven theme, and can't easily understand where can be the problem?

So, maybe remove this global override with !important and replace it with direct rules only for needed elements?

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024