It's also applied to switching dialect, word choice, and even accent. Lots of people in the US who grow up with any kind of regional or ethnic accent or English-variant end up being capable of code-switching to Standard American English, especially if they move around much and/or attend school somewhere outside the area where their dialect is normal, though even regional schools will provide some social pressure to avoid non-standard accents or dialects that are common in their areas. AAVE (African-American Vernacular English) is a commonly-cited variant from which one may wish (or feel strong pressure) to code-switch to SAE, but similar (if less race-fraught, so perhaps not directly comparable) pressure exists for people with strong Bostonian or Appalachian or rural-midwestern accents, or most anything other than SAE.
The positive reason for this, is that it allows potentially extreme variants and dialects to co-exist while letting everyone still communicate clearly with others (by code-switching to whatever's considered standard). The down-side is that it often exists alongside negative stereotypes about those who can't, or choose not to, code-switch to SAE (but, of course, refusing to becomes its own counter-signal for very high status—Fussell, for instance, observes that adhering to SAE is a middle-class and up tendency, but not among "old money" or his "top-out-of-sight" rich, since they don't need, at any point in their life, to give a damn whether some employer or other gate-keeper judges them worthy or intelligent or whatever).