JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="col-md-12 test">
  <h3 style="color: #12FF12">Heading</h3>
  <div class="box no-border shadow" id="filePrintPreview" style="padding: 2px; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-line;">
  </div>
</div>

<button class="btn btn-flat btn-primary btn-sm" style="margin-top:15px;"
                            onclick=" window.print();">Print
                    </button>

CSS

@media print {
.test {
    background-color: #1a4567 !important;
    -webkit-print-color-adjust: exact; 
}
}

JavaScript

$('#filePrintPreview').html("TEST");
$('#filePrintPreview').css('color', 'red');