Shades of Gray
This could be Shades of Gray, by Jasper Fforde (not to be confused with 50 Shades of Grey).Made more confusing by the fact that one has a Red Room and the other has a Green Room.
They would go into the Green Room and partake of the color painted
within—the shade of green that you saw only once in your life, when it
was time to go. The color painted within the Green Room was known as
“sweetdream” and would render you unconscious in twelve minutes and
dead in sixteen, but during those twelve minutes every synapse in your
brain would fire in a sparkling fountain of pleasure.
Everyone has, not an electronic chip, but a barcode. According to Fforde, everyone has barcodes growing out of their nailbeds.
She had decoded seven of the known thirty-one variants, yet had been
unable to explain exactly what benefit bar codes held over numbers,
nor why almost everything tended to have them. Not just all the
pre-Epiphanic artifacture but almost everything else, too—from
Perpetulite to oaks, yateveos, slugs, fruit flies, mice, root
vegetables, rhinosauruses—even us, with something similar to a bar
code growing out of our left-hand nail beds.
The society is stratified by which color one can see, with a lot more than Red or Green (although they do seem to be mentioned quite frequently).
I found Jane, too, or perhaps she found me. It doesn’t really matter.
We found each other. And although she was Grey and I was Red, we
shared a common thirst for justice that transcended Chromatic
politics.
The protagonist is reassigned as a laborer for playing a prank on the son of a prefect (TVTropes Warning):
“No,” I replied. “I made Bertie Magenta do the elephant trick at
lunch. Two jets of milk shot out of his nostrils and went all over
Miss Bluebird. I successfully pleaded Prank status, but the head
prefect thought a bit of humility reassignment in the Outer Fringes
might be good for me. Bertie is his son, you see.”
The woman, Jane, is a Green, but a weak one (half-high-class):
“Problems?” I asked, sitting down next to her. “Only of a personal
nature. It won’t alter our Grand Plan. It’s just that, well . . I
turned out twelve percent Yellow.”
I laughed. It was only 2 percent
above threshold, so was as good as nothing, and for Jane’s huge
dislike of Yellows, there was the nub of a fine joke about it. “You’re
no longer a Grey. That must make you a Primrose, minimum. Has Bunty
asked you to spy on anyone yet?”
“Eddie,” she said with a serious look
that I didn’t much like, “there’s something else. I’ve also got
fourteen percent Blue.”
She does have a brother:
“He’s with me,” said Jane, coming out of the house, holding a plate
with a slice of cake on it. “Clifton, this is the swatchman’s son.
Red, this is Clifton, my brother.”
In addition, she ends up not marrying the protagonist in the end, because they are complementary colors.
This was published in 2009, so only six years before you asked your question. That and the electronic chip would make it seem unlikely that this it, if not for the strong evidence of the color-coded society.