Skip to content

Commit 0254c8b

Browse files
authored
Merge pull request #3212 from takluyver/print-color
Patch out bootstrap rule forcing black and white printing
2 parents 31215b8 + 622a886 commit 0254c8b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

setupbase.py

+24
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,28 @@ def run(self):
398398
update_package_data(self.distribution)
399399

400400

401+
def patch_out_bootstrap_bw_print():
402+
"""Hack! Manually patch out the bootstrap rule that forces printing in B&W.
403+
404+
We haven't found a way to override this rule with another one.
405+
"""
406+
print_less = pjoin(static, 'components', 'bootstrap', 'less', 'print.less')
407+
with open(print_less) as f:
408+
lines = f.readlines()
409+
410+
for ix, line in enumerate(lines):
411+
if 'Black prints faster' in line:
412+
break
413+
else:
414+
return # Already patched out, nothing to do.
415+
416+
rmed = lines.pop(ix)
417+
print("Removed line", ix, "from bootstrap print.less:")
418+
print("-", rmed)
419+
print()
420+
with open(print_less, 'w') as f:
421+
f.writelines(lines)
422+
401423
class CompileCSS(Command):
402424
"""Recompile Notebook CSS
403425
@@ -424,6 +446,8 @@ def run(self):
424446
self.run_command('jsdeps')
425447
env = os.environ.copy()
426448
env['PATH'] = npm_path
449+
450+
patch_out_bootstrap_bw_print()
427451

428452
for src, dst in zip(self.sources, self.targets):
429453
try:

0 commit comments

Comments
 (0)