F# 实用工具:F# Depth Colorizer

色彩区分代码结构在F#中已经实现

上周提到我一直致力于一个编辑器的扩展的开发,如今,它已经可用了,并且你可以尝试一下!你可以从Visual Studio Gallery中获取F# Depth Colorizer (也就是我说的扩展)。鼠标单击进行安装;安装完成后,你可以在Visual Studio中的“工具\扩展管理器”菜单中找到它。

替换图片01

安装完成后, 你的代码结构会在编辑器中被高亮的显示出来,如下图所示:

替换图片02

或者像这样:

替换图片03

而不是像原来那样平铺着代码:

替换图片04

明白了么?就像前两幅图中显示的那样,颜色是可以自己配制的。我并不是太擅长界面颜色的配制,所以用户可以通过注册表来配置这些颜色。(编辑:亦可见这里)。如果你没有这个注册表项,你的编辑器中会默认的显示为灰色,就像第一个截图那样。下面的注册表值代表灰度值:

 

Windows RegistryEditor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TextEditor\FSharpDepthColorizer]
"Depth0"="190,190,190,230,230,230"
"Depth1"="170,170,170,210,210,210"
"Depth2"="184,184,184,224,224,224"
"Depth3"="164,164,164,204,204,204"
"Depth4"="178,178,178,218,218,218"
"Depth5"="158,158,158,198,198,198"
"Depth6"="172,172,172,212,212,212"
"Depth7"="152,152,152,192,192,192"
"Depth8"="166,166,166,206,206,206"
"Depth9"="146,146,146,186,186,186"

另外,第二副截图中的红-蓝色彩的注册表值如下所示:

 

Windows RegistryEditor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TextEditor\FSharpDepthColorizer]
"Depth0"="240,180,180,240,220,220"
"Depth1"="180,180,240,220,220,240"
"Depth2"="240,172,172,240,216,212"
"Depth3"="172,172,240,212,216,240"
"Depth4"="240,164,164,240,212,204"
"Depth5"="164,164,240,204,212,240"
"Depth6"="240,156,156,240,208,196"
"Depth7"="156,156,240,196,208,240"
"Depth8"="240,148,148,240,204,188"
"Depth9"="148,148,240,188,204,240"

通常这个扩展会查找这些注册表值。(你可以保存上面的注册表值到文件“foo.reg中,然后运行这个文件来写入注册表,或者通过“regedit工具来检查\更改这些值。一定要小心的更改你的注册表!)

六个数字字符串组成了DepthN的值,它代表了两组RGB值,如:

DepthN = R1G1B1R2G2B2

N代表代码嵌套的结构层次数时,RGB1代表了左边边缘的高亮颜色(目的是为了让边缘界线更明显),RGB2的值将成为应用在嵌套层次上的主要高亮色彩。下图会有10层的嵌套,颜色会被循环使用在一层层的代码结构上:

替换图片05

而且这些颜色会越来越暗,直到第10层,当到达11层时,又会循环到色彩集合中最亮的粉色。

我会很快发布此VSIX扩展的源代码。(编辑:可以在这里察看发布情况。)现在,我鼓励大家尝试一下,你可以将反馈留在我的博客或画廊。用的开心!

(非常感谢Noah帮我完成了这个扩展在编辑器中的部分。谢谢那些帮我完成Beta版测试和提供反馈的朋友们。)

 

原文链接:http://lorgonblog.wordpress.com/2010/11/18/f-source-code-structural-colorizer-available/

(base) hxwang@raspberrypi:~/realsense_build/librealsense-master/build/wrappers/python $ sudo pip install . --break-system-packages Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Processing /home/hxwang/realsense_build/librealsense-master/build/wrappers/python Preparing metadata (setup.py) ... done Building wheels for collected packages: pyrealsense2 Building wheel for pyrealsense2 (setup.py) ... done Created wheel for pyrealsense2: filename=pyrealsense2-2.55.1-py3-none-any.whl size=520734 sha256=539e7b9fff0c8de7d6eb732ae8a7755de26c5f44367fabf225fdaeee429075ef Stored in directory: /tmp/pip-ephem-wheel-cache-90lin6tz/wheels/c2/26/b6/af813fa561492a8526f6a535300afb985818e02a66048d71f2 Successfully built pyrealsense2 Installing collected packages: pyrealsense2 Attempting uninstall: pyrealsense2 Found existing installation: pyrealsense2 2.55.1 Uninstalling pyrealsense2-2.55.1: Successfully uninstalled pyrealsense2-2.55.1 Successfully installed pyrealsense2-2.55.1 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv (base) hxwang@raspberrypi:~/realsense_build/librealsense-master/build/wrappers/python $ python -c "import pyrealsense2 as rs; print(dir(rs))" ['BufData', 'D400', 'D500', 'DEPTH', 'L500', 'SR300', 'STAEControl', 'STAFactor', 'STCensusRadius', 'STColorControl', 'STColorCorrection', 'STDepthControlGroup', 'STDepthTableControl', 'STHdad', 'STRauColorThresholdsControl', 'STRauSupportVectorControl', 'STRsm', 'STSloColorThresholdsControl', 'STSloPenaltyControl', 'T200', 'TRACKING', '__doc__', '__file__', '__full_version__', '__loader__', '__name__', '__package__', '__spec__', '__version__', 'align', 'any', 'any_intel', 'auto_calibrated_device', 'calib_target_type', 'calibration_change_device', 'calibration_status', 'calibration_type', 'camera_info', 'color_sensor', 'colorizer', 'composite_frame', 'config', 'context', 'debug_protocol', 'debug_stream_sensor', 'decimation_filter', 'depth_frame', 'depth_sensor', 'depth_stereo_sensor', 'device', 'device_calibration', 'device_list', 'disparity_frame', 'disparity_transform', 'distortion', 'enable_rolling_log_file', 'event_information', 'extension', 'extrinsics', 'filter', 'filter_interface', 'firmware_log_message', 'firmware_log_parsed_message', 'firmware_logger', 'fisheye_sensor', 'format', 'frame', 'frame_metadata_value', 'frame_queue', 'frame_source', 'hdr_merge', 'hole_filling_filter', 'intrinsics', 'l500_visual_preset', 'log', 'log_message', 'log_severity', 'log_to_callback', 'log_to_console', 'log_to_file', 'matchers', 'max_usable_range_sensor', 'motion_device_intrinsic', 'motion_frame', 'motion_sensor', 'motion_stream', 'motion_stream_profile', 'non_intel', 'notification', 'notification_category', 'option', 'option_from_string', 'option_range', 'option_type', 'option_value', 'options', 'options_list', 'pipeline', 'pipeline_profile', 'pipeline_wrapper', 'playback', 'playback_status', 'pointcloud', 'points', 'pose', 'pose_frame', 'pose_sensor', 'pose_stream', 'pose_stream_profile', 'processing_block', 'product_line', 'quaternion', 'recorder', 'region_of_interest', 'reset_logger', 'roi_sensor', 'rs2_deproject_pixel_to_point', 'rs2_fov', 'rs2_project_color_pixel_to_depth_pixel', 'rs2_project_point_to_pixel', 'rs2_transform_point_to_point', 'rs400_advanced_mode', 'rs400_visual_preset', 'save_single_frameset', 'save_to_ply', 'sensor', 'sequence_id_filter', 'serializable_device', 'software_device', 'software_motion_frame', 'software_notification', 'software_pose_frame', 'software_sensor', 'software_video_frame', 'spatial_filter', 'stream', 'stream_profile', 'sw_only', 'syncer', 'temporal_filter', 'terminal_parser', 'texture_coordinate', 'threshold_filter', 'timestamp_domain', 'units_transform', 'updatable', 'update_device', 'vector', 'vertex', 'video_frame', 'video_stream', 'video_stream_profile', 'wheel_odometer', 'yuy_decoder'] (base) hxwang@raspberrypi:~/realsense_build/librealsense-master/build/wrappers/python $ cd (base) hxwang@raspberrypi:~ $ cd yolov5 (base) hxwang@raspberrypi:~/yolov5 $ python 3D_rappy.py Traceback (most recent call last): File "/home/hxwang/yolov5/3D_rappy.py", line 16, in <module> pipeline = rs.pipeline() ^^^^^^^^^^^ AttributeError: module 'pyrealsense2' has no attribute 'pipeline' (base) hxwang@raspberrypi:~/yolov5 $
07-07
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值