I've been searching for how to turn the Gmail IMAP grey/white folders to blue and came across this thread. It has triggered a lightbulb in my brain so I'll add my discoveries (which are not necessarily specific to the original post in this thread).....
The grey/white folder icon in Apple Mail represents a "folder" and the blue folder icon represents a "mailbox". "Folders" cannot contain messages, they can only contain mailboxes or other "folders". Mailboxes can contain any of messages, folders, mailboxes.
In Gmail the "folders" are actually labels, and subfolders are formed by having a slash "/" in the label name.
If a label representing a subfolder exists on Gmail but there is no label representing the parent folder, then Apple Mail will show the parent icon as a folder (grey/white icon).
The origin of these grey/white folders would seem to usually be from a migration/upload process from an old mail account to Gmail where the migration did not create a label for the parent folder. In my case a migration from Windows Outlook.
The way to turn the white IMAP folders to blue, and hence allow them to contain messages, is to create a label in Gmail with the same name as that white folder. When Apple Mail next synchronises it will set the icon to blue.