diff --git a/gsm-frontend/src/components/OpenTTDConfigEditor.jsx b/gsm-frontend/src/components/OpenTTDConfigEditor.jsx
index b30dfa1..78184b2 100644
--- a/gsm-frontend/src/components/OpenTTDConfigEditor.jsx
+++ b/gsm-frontend/src/components/OpenTTDConfigEditor.jsx
@@ -91,10 +91,13 @@ export default function OpenTTDConfigEditor({ token }) {
const key = highlighted.substring(0, idx)
const value = highlighted.substring(idx + 1)
- // Color numbers, true/false, and quoted strings
+ // Color numbers first (with placeholders), then booleans
+ // This prevents the regex from matching numbers in CSS class names like "text-orange-400"
let coloredValue = value
+ .replace(/\b(\d+)\b/g, '%%%NUM_START%%%$1%%%NUM_END%%%')
.replace(/\b(true|false)\b/gi, '$1')
- .replace(/\b(\d+)\b/g, '$1')
+ .replace(/%%%NUM_START%%%/g, '')
+ .replace(/%%%NUM_END%%%/g, '')
highlighted = `${key}=${coloredValue}`
}
diff --git a/gsm-frontend/src/components/PalworldConfigEditor.jsx b/gsm-frontend/src/components/PalworldConfigEditor.jsx
index f3b7752..79d7166 100644
--- a/gsm-frontend/src/components/PalworldConfigEditor.jsx
+++ b/gsm-frontend/src/components/PalworldConfigEditor.jsx
@@ -152,10 +152,13 @@ export default function PalworldConfigEditor({ token }) {
const key = highlighted.substring(0, idx)
const value = highlighted.substring(idx + 1)
- // Color boolean values
+ // Color numbers first (before adding any HTML tags), then booleans
+ // This prevents the regex from matching numbers in CSS class names like "text-orange-400"
let coloredValue = value
+ .replace(/\b(\d+\.?\d*)\b/g, '%%%NUM_START%%%$1%%%NUM_END%%%')
.replace(/\b(True|False)\b/gi, '$1')
- .replace(/\b(\d+\.?\d*)\b/g, '$1')
+ .replace(/%%%NUM_START%%%/g, '')
+ .replace(/%%%NUM_END%%%/g, '')
highlighted = `${key}=${coloredValue}`
}
diff --git a/gsm-frontend/src/components/ZomboidConfigEditor.jsx b/gsm-frontend/src/components/ZomboidConfigEditor.jsx
index 014b8f2..ee2c41b 100644
--- a/gsm-frontend/src/components/ZomboidConfigEditor.jsx
+++ b/gsm-frontend/src/components/ZomboidConfigEditor.jsx
@@ -122,12 +122,13 @@ export default function ZomboidConfigEditor({ token }) {
const comment = highlighted.substring(idx)
highlighted = `${code}${comment}`
}
- // Highlight true/false/nil
+ // Highlight numbers first (with placeholders), then booleans
+ // This prevents the regex from matching numbers in CSS class names like "text-orange-400"
highlighted = highlighted
+ .replace(/\b(\d+\.?\d*)\b/g, '%%%NUM_START%%%$1%%%NUM_END%%%')
.replace(/\b(true|false|nil)\b/g, '$1')
- // Highlight numbers
- highlighted = highlighted
- .replace(/\b(\d+\.?\d*)\b/g, '$1')
+ .replace(/%%%NUM_START%%%/g, '')
+ .replace(/%%%NUM_END%%%/g, '')
} else {
// INI: # comments
if (line.trim().startsWith('#')) {