The built-in IRC client erc
has the ability to colorize any text using
escape sequences that start with ‘^C’ (inserted with C-q C-c) and are
followed by a number for the foreground and background.4 Possible numbers are 0-15, with the
first entry being the foreground and the second the background,
separated by a comma. Like this ‘^C1,6’. The minimum setup is this:
(add-to-list 'erc-modules 'irccontrols) (setq erc-interpret-controls-p t erc-interpret-mirc-color t)
As this allows users the chance to make arbitrary combinations, it is impossible to guarantee a consistently high contrast ratio. All we can we do is provide guidance on the combinations that satisfy the accessibility standard of the themes:
Use foreground color 1 for all backgrounds from 2-15. Like so: C-q C-c1 where ‘N’ is the background.
Use foreground color 0 for all backgrounds from 2-13. Use foreground ‘1’ for backgrounds 14, 15.
Colors 0 and 1 are white and black respectively. So combine them together, if you must.
This page explains the basics, though it is not specific to Emacs: https://www.mirc.com/colors.html