You can easily achieve this, using SharePoint Designer and conditional formatting feature.
Just open your SharePoint designer, navigate to the document library, and under Views section, click on "AllItems.aspx".
Then, you will see the designer for view.
Select the particular item you want to colorize (make sure
td element is selected, as it shown on the screenshot above), right-click on it and select "Conditional formatting":
The conditional formatting panel will appear on the left. Select "Create" => "Apply formatting...".
You will see now the condition criteria form.
Apply needed filters (you can select field name, comparison operation, and the value to compare), and then click "Set Style", and select background color.
No code at all! :)