How to increase font size of Google colab cell output?

Viewed 3003

Does anyone know how to increase font size of google colab cell outputs.

By this I mean when the cell returns text/numbers/etc via print functions or any other return mechanism.

Its too small.

I am using colab on Mac OS with Safari/Chrome. We can increase the font size of what we code inside the cells both with colab settings or browser settings.

But I fail to find a solution for output font size.

(I attached a screenshot] here : 1

1 Answers

You can change the stylesheet of the output frame, increasing its font-size to 30px (or other values).

def increase_font():
  from IPython.display import Javascript
  display(Javascript('''
  for (rule of document.styleSheets[0].cssRules){
    if (rule.selectorText=='body') {
      rule.style.fontSize = '30px'
      break
    }
  }
  '''))

Then experiment which value you want. And change 30px to what you like.

increase_font()
print("Hello")

Then set it to run in every cell automatically.

get_ipython().events.register('pre_run_cell', increase_font)

Here's an example notebook.

Related