Skip to content

Commit

Permalink
Merge pull request #3212 from takluyver/print-color
Browse files Browse the repository at this point in the history
Patch out bootstrap rule forcing black and white printing
  • Loading branch information
Carreau authored Jan 22, 2018
2 parents 31215b8 + 622a886 commit 0254c8b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions setupbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,28 @@ def run(self):
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
Expand All @@ -424,6 +446,8 @@ def run(self):
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:
Expand Down

0 comments on commit 0254c8b

Please sign in to comment.