I've seen this issue come up before.
https://forums.mirc.com/ubbthreads.php?ubb=showflat&Number=176128I'm afraid the only way you can safely put colorcodes into ini's is to either $encode them before writing, or do a search+replace to change them into values that can be written yet won't be appearing in the strings you'll be writing.