View Issue Details

IDProjectCategoryView StatusLast Update
0023631mantisbtprintingpublic2021-01-29 09:48
Reporteratrol Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Summary0023631: Wrong status color when printing
Description

The status square is always black when printing.

TagsNo tags attached.
Attached Files
print-status-colors.PNG (21,576 bytes)   
print-status-colors.PNG (21,576 bytes)   

Activities

lexlogos

lexlogos

2017-11-14 05:18

reporter   ~0058195

From my point of view, this problem occurs when the selected printer is black and white.

atrol

atrol

2017-11-14 07:16

developer   ~0058196

this problem occurs when the selected printer is black and white.

I don't hink so. At least the avatars are colored.

PrintMyView.PNG (41,069 bytes)   
PrintMyView.PNG (41,069 bytes)   
stevecharon

stevecharon

2019-04-17 09:43

reporter   ~0061947

Yes, the status colors are black even with a color printer and Print to PDF in Chrome. As @atrol mentioned, the avatars are just fine. Needs a fix since 2.5!

dregad

dregad

2019-04-17 10:59

developer   ~0061948

The problem is caused by bootstrap, which forces black color for print media.

https://github.com/twbs/bootstrap/blob/v3.4.0/dist/css/bootstrap.css#L199

We would need to override that somehow. I'm not a CSS expert though, so not sure what the best approach would be. Since the CSS is generated dynamically, this would probably have to be done in css/status_config.php, but currently that is loaded before bootstrap so that might have to be changed.

dregad

dregad

2019-04-17 12:42

developer   ~0061949

Last edited: 2019-04-17 12:47

I made some tests which lead me to think that this should be possible, but I'm confused with the results. Maybe someone more qualified than me with CSS can shed some light.

In status_config.php, add the following line in the foreach loop

echo "@media print { ." . html_get_status_css_fg( $t_id ) . ":before { color: green !important; } }\n";

In print preview, this causes all status boxes to show in green. So far, so good. BUT:

echo "@media print { ." . html_get_status_css_fg( $t_id ) . ":before { color: {$t_color} !important; } }\n";

Shows the boxes with faded colors unrelated to the defined RGB values for MantisBT status colors !

EDIT:
I found that by adding non-standard CSS property -webkit-print-color-adjust: exact; allows Chrome to render color as expected. It still does not work for Firefox though. Have not tried any other browsers.

polzin

polzin

2021-01-29 09:48

reporter   ~0065045

The reason for the firefox problem could be that you have to click on the "color" in the printing settings. At least that was the case here.

It is considered a bootstrap "feature"...
https://stackoverflow.com/questions/33410724/bootstrap-print-css-removes-background-color
https://stackoverflow.com/questions/35202552/colored-bootstrap-glyphicons-is-printed-black

They suggest css similar to yours, but without ":before".