Hi Juri,

Thank you very much for the detailed test case.
Previously I tried in the MATE terminal emulator,
but xterm-256color was an essential detail indeed.
Now I was able to reproduce with TERM="xterm-256color"
and to track down the source of this problem.

It happens while the color "ForestGreen" is loaded for
the face font-lock-type-face that has this definition:

  (((class color) (min-colors 16) (background light))
   :foreground "ForestGreen")

by tty-color-canonicalize.

Could you please try this patch to see if it fixes the problem:

diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 307586f221..5af8170203 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -820,7 +820,7 @@ tty-color-canonicalize
   "Return COLOR in canonical form.
 A canonicalized color name is all-lower case, with any blanks removed."
   (let ((case-fold-search nil))
-    (if (string-match "[A-Z ]" color)
+    (if (string-match-p "[A-Z ]" color)
        (replace-regexp-in-string " +" "" (downcase color))
       color)))

Thank you for root-causing this! The patch you provided does indeed fix the issue for me.

Best,
Jayden