chatbuf_color: use a simple loop instead of local function