Merge pull request #3212 from takluyver/print-color

Patch out bootstrap rule forcing black and white printing
This commit is contained in:
Matthias Bussonnier 2018-01-21 18:30:33 -08:00 committed by GitHub
commit 0254c8bc01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -398,6 +398,28 @@ class Bower(Command):
update_package_data(self.distribution)
def patch_out_bootstrap_bw_print():
"""Hack! Manually patch out the bootstrap rule that forces printing in B&W.
We haven't found a way to override this rule with another one.
"""
print_less = pjoin(static, 'components', 'bootstrap', 'less', 'print.less')
with open(print_less) as f:
lines = f.readlines()
for ix, line in enumerate(lines):
if 'Black prints faster' in line:
break
else:
return # Already patched out, nothing to do.
rmed = lines.pop(ix)
print("Removed line", ix, "from bootstrap print.less:")
print("-", rmed)
print()
with open(print_less, 'w') as f:
f.writelines(lines)
class CompileCSS(Command):
"""Recompile Notebook CSS
@ -424,6 +446,8 @@ class CompileCSS(Command):
self.run_command('jsdeps')
env = os.environ.copy()
env['PATH'] = npm_path
patch_out_bootstrap_bw_print()
for src, dst in zip(self.sources, self.targets):
try: