From 289ee4ed692c726ed9b4497099287add9f1bc0fd Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 10 Feb 2026 00:42:11 +0100 Subject: feat: Add WGSL syntax highlighting Overlay highlighting: keywords, types, attributes, functions, numbers, comments. Co-Authored-By: Claude Sonnet 4.5 --- tools/shader_editor/index.html | 90 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 4 deletions(-) (limited to 'tools/shader_editor') diff --git a/tools/shader_editor/index.html b/tools/shader_editor/index.html index 122c15e..5db06de 100644 --- a/tools/shader_editor/index.html +++ b/tools/shader_editor/index.html @@ -166,11 +166,21 @@ body { background: #1177bb; } -#code-editor { +.editor-container { flex: 1; + position: relative; + overflow: hidden; +} + +#code-editor { + position: absolute; + top: 0; + left: 0; width: 100%; - background: #1e1e1e; - color: #d4d4d4; + height: 100%; + background: transparent; + color: transparent; + caret-color: #d4d4d4; border: none; padding: 15px; font-family: 'Courier New', monospace; @@ -178,8 +188,36 @@ body { line-height: 1.5; resize: none; outline: none; + z-index: 2; } +#syntax-highlight { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #1e1e1e; + color: #d4d4d4; + padding: 15px; + font-family: 'Courier New', monospace; + font-size: 13px; + line-height: 1.5; + white-space: pre-wrap; + word-wrap: break-word; + overflow: auto; + pointer-events: none; + z-index: 1; +} + +.hl-keyword { color: #569cd6; } +.hl-type { color: #4ec9b0; } +.hl-attribute { color: #9cdcfe; } +.hl-function { color: #dcdcaa; } +.hl-number { color: #b5cea8; } +.hl-comment { color: #6a9955; } +.hl-string { color: #ce9178; } + .snippets-panel { background: #252526; border-top: 1px solid #3e3e42; @@ -256,7 +294,10 @@ body { - +
+
+ +