The relationship between the color clue and the books is not very obvious, an ornament of those colors on the books would help to better understand the riddle... The relationship between the paintings and the sins is not very evident, it is difficult to get it right without resorting to the walkthrought .
I'll admit, I had trouble with the code at first when we were testing that, but if you take the time to look at each of the paintings, it makes a bit more sense.
[going by the order of the books]
The painting in the dining room with the woman in orange surrounded by cakes and pastries represents gluttony (Book of Sin Volume 1 -
Orange).
The painting in Madeline's bedroom with a woman wearing a golden dress represents greed (Book of Sin Volume 2. -
Yellow).
The painting upstairs and to the left of a woman sleeping, while wearing a light blue gown represents sloth (Book of Sin Volume 3 -
Light Blue).
The painting upstairs and to the right of a woman wearing a green dress represents envy (Book of Sin Volume 4 -
Green).
The painting in the kitchen of a woman wearing a purple dress represents pride (Book of Sin Volume 5 -
Purple).
The painting in Madeline's office of a woman wearing a red cloak represents wrath (Book of Sin Volume 6 -
Red).
The painting in the living room of the woman wearing dark blue lingerie represents lust (Book of Sin Volume 7 -
Dark Blue).
So if your color code was, let's say,
red,
orange,
green and
light blue, then your passcode would be: 6143
You determine that by putting the book volumes in order of the colors you see to get the code that unlocks the metal door. In my example above, it's:
Volume 6,
Volume 1,
Volume 4 and
Volume 3.