I just designed the Pm System[a simple rather to say], now i wanted to design a color selector for the system, when viewing all pm’s it should be shown with different colors similar to google’s approach on gmail. below is my existing database schema
**Messages:**
Id:int identity 1,1
Message: nvarchar(500)
From:nvarchar(100)
To:nvarchar(100)
IsDeleted: Bit
IsRead: Bit
How can i add a Color field in a way that it does not interfere with existing setup. Ex, color for Read messages, color for Deleted Messages[lol] so that i could show distinction using background color
I’m assuming (perhaps wrongly) this is being output as HTML.
Databases are for data, the colour of a read message is presentation. Rather then store a colour in the database for every single message, or even once in a table just for that, use HTML to indicate its status.
When you’re outputting the message list in HTML add a class that indicates it’s status based on the database value:
In your CSS define the style for read, deleted etc however you want:
This keeps your database, your HTML, and your CSS all separate which is the way it should be.