As mentioned, race is a social construct and the terms black, white, etc. may not even accurately encompass everyone within that race's skintone. In fact, the term of "race" to refer to groups of people only became common around the 16-17th century, and it is believed by most anthropologists and socialists that the concept arose as a justification for European imperialism and slavery by separating people into "superior" and "inferior" races. Keep in mind though, even before the modern idea of race existed, the act of a group of people discriminating against another group of people based on arbitrary combinations of physical features and place of origin still existed.
When making a fictional world with people of different skin tones and ethnicities, you would probably have to consider the social and cultural environment and if it would have the same dynamics as our world. Would the circumstances you set up in your world lead to the same effects where groups of people would be socially categorized as "black", "white", etc.? Or would it make more sense for people to categorize by only "ethnicity" (I'm assuming that it would be fantasy ethnicities based on the fact this is a fictional world)
For example, I could see this categorization of people making sense if, mirroring our real world history, there would be a period in time where several different groups of people, all within a specific region and all having most of the population share similar physical features, engaged in imperialistic activity against other regions. Let's say one of the most defining physical traits that separates the different regions is skintone. Then I could see the color-coded categorization.
Giving a counter-example, maybe the defining traits separating different regions would be one region where most of the people have horns, and another region where most of the people don't have horns. Then, maybe in that scenario, the people might be separated into terms like "Horns" and "No-Horns"