如何增加 Google colab 单元格输出的字体大小?

How to increase font size of Google colab cell output?

有谁知道如何增加 google colab 单元格输出的字体大小。

我的意思是当单元格 returns text/numbers/etc 通过打印功能或任何其他 return 机制。

太小了。

我在 Mac OS 和 Safari/Chrome 上使用 colab。我们可以使用 colab 设置或浏览器设置来增加我们在单元格中编码的内容的字体大小。

但是我没有找到输出字体大小的解决方案。

(我在此处附上了截图]:1

您可以更改输出框架的样式表,将其字体大小增加到 30px(或其他值)。

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
    }
  }
  '''))

然后试验你想要的值。并将30px改成你喜欢的。

increase_font()
print("Hello")

然后在每个单元格中自动将其设置为 运行。

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

这是一个 example notebook