diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
index e09276bc15669b7735edb7e71f33581f0a932849..d5645dec04d69ca1f316b4ab6b04b085ed1ed436 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
@@ -183,13 +183,13 @@ class IrcFormatSerializer @Inject constructor(private val context: Context) {
 
         val hasForegroundBefore = foreground != null
         val hasBackgroundBefore = background != null
-        val foregroundBeforeCodeValid = foregroundCode != null
-        val backgroundBeforeCodeValid = backgroundCode != null
+        val foregroundBeforeCodeValid = foregroundCode != null && foregroundCode < 16
+        val backgroundBeforeCodeValid = backgroundCode != null && backgroundCode < 16
 
         val hasForegroundAfter = afterForeground != null
         val hasBackgroundAfter = afterBackground != null
-        val foregroundAfterCodeValid = afterForegroundCode != null
-        val backgroundAfterCodeValid = afterBackgroundCode != null
+        val foregroundAfterCodeValid = afterForegroundCode != null && afterForegroundCode < 16
+        val backgroundAfterCodeValid = afterBackgroundCode != null && afterBackgroundCode < 16
 
         if ((!hasBackgroundAfter || backgroundAfterCodeValid) &&
             (!hasForegroundAfter || foregroundAfterCodeValid) &&