Change color and thickness of x and y axis as well as viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By csk


As my eyes are getting older, and as I’m working with 2d scenes, I’m having a hard time seeing the x and y axis as well as the viewport.

I have found the editor setting for the viewport border color under Editor Settings → Editors → 2D → Viewport Border Color and was able to remove the transparency, so the line is a little brighter. I have found no way to change the thickness.

I have not found any way to modify the color or thickness of the x and y axis.

Are these properties editable?

Any help would be most appreciated.

edited, hope this help

Whalesstate | 2021-09-19 18:49

:bust_in_silhouette: Reply From: Whalesstate

Create a new Node2D script and paste this code to it and save it to your resources as then in any 2d scene , search node " Axis " and add it to the scene

extends Node2D
class_name Axis
export(int, 1, 20) var width = 10 setget set_width

func set_width(v : int):
    width = v

func _draw() -> void:
    if not Engine.editor_hint: return
    draw_line(Vector2(-100000, 0), Vector2(100000, 0),, width)
    draw_line(Vector2(0, -100000), Vector2(0, 100000),, width)

and to change the viewport bg color open [ project settings → Rendering → Environment → Default Clear Color ]

Thank you very much! I will give this a try :slight_smile:

csk | 2021-09-20 14:06