tty-find-type

tty-find-type is a compiled Lisp function in `faces.el'.

(tty-find-type PRED TYPE)

Return the longest prefix of TYPE to which PRED returns non-nil.
TYPE should be a tty type name such as "xterm-16color".

The function tries only those prefixes that are followed by a
dash or underscore in the original type name, like "xterm" in
the above example.