Jupyter笔记本用不同的颜色涂上不同的括号 [英] Jupyter notebook color different parentheses by different colors

查看:118
本文介绍了Jupyter笔记本用不同的颜色涂上不同的括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将匹配的括号悬停在它们周围时,我会看到突出显示的绿色,但是可以为它们添加其他颜色语法,以使匹配的括号具有不同的颜色.

  • 为此有压力吗?
  • 有没有一种方法可以向custom.js添加一些代码来实现它.

示例代码:

 #创建新功能df =(df.withColumn(("rooms_per_hh",F.round(col('total_rooms')/col('households'),2))).withColumn(("pop_per_hh",F.round(col('pop')/col('households'),2))).withColumn(("bedrooms_per_rooms",F.round(col('total_bedrooms')/col('total_rooms'),2)))) 

我喜欢在这里为不同的括号看到不同的颜色.

相关链接:
-

解决方案

我认为您可以使用jupyter-notebook-themes Google Chrome 并添加 .cm-s-ipython .CodeMirror-matchingbracket {color:black!important;} 或其他用于更改内部括号颜色的内容./p>

然后,您可以将其作为自定义扩展程序添加到Chrome.

I can see the matching parenthesis hightlights green when I hover around them, but is it possible to add additional color syntax to them so that the matching parenthesis have different colors.

  • Is there any nbextension for that?
  • Is there a way to add some code to custom.js that will make it happen.

Example code:

# create new features
df = (df
 .withColumn(("rooms_per_hh", F.round(col('total_rooms') / col('households'), 2)))
 .withColumn(("pop_per_hh", F.round(col('pop') / col('households'), 2)))
 .withColumn(("bedrooms_per_rooms", F.round(col('total_bedrooms') / col('total_rooms'), 2)))
     )

I like to see different colors for different parentheses here.

Related links:
- Changing jupyter's matching parenthesis color
- Replace / remove highlighting in Jupyter Notebook with custom theme

Required output:

解决方案

I think you can use jupyter-notebook-themes Google Chrome and add .cm-s-ipython .CodeMirror-matchingbracket { color: black !important;} or some thing else to change coloring of inner parenthesis.

Then you can add it to your Chrome as a custom extension.

这篇关于Jupyter笔记本用不同的颜色涂上不同的括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆