Skip to content

Commit 778c8d7

Browse files
committed
Script Window: Don't clamp font color alpha channel to 0.65
Because the CodeEdit's readonly property is set, TextEdit forces the alpha channel of all text rendered to be no higher than the alpha channel of the default colour for text in disabled controls, which is 0.65 as I type this. While we do not want the code in this popover to be editable, we do want it to be legible. Override the relevant font color on the control to set its alpha channel to 1, effectively disabling this undesired clamping.
1 parent 527bc4b commit 778c8d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

addons/block_code/ui/script_window/script_window.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ func _apply_editor_syntax_highlighter():
1818
break
1919

2020

21+
## Undoes the effect of the CodeEdit being read-only
22+
func _remove_font_color_alpha_clamp():
23+
var font_readonly_color = script_label.get_theme_color("font_readonly_color")
24+
font_readonly_color.a = 1
25+
script_label.add_theme_color_override("font_readonly_color", font_readonly_color)
26+
27+
2128
func _ready():
2229
_apply_editor_syntax_highlighter()
30+
_remove_font_color_alpha_clamp()
2331
script_label.text = script_content.replace("\t", " ")
2432

2533

0 commit comments

Comments
 (0)