Generate unique foreground for each user
This commit is contained in:
parent
77d914312c
commit
503c196d4f
|
@ -177,6 +177,32 @@ CayaTintColor(rgb_color color, int severity)
|
|||
}
|
||||
|
||||
|
||||
rgb_color
|
||||
CayaForegroundColor(rgb_color background)
|
||||
{
|
||||
rgb_color foreground;
|
||||
int32 brighter;
|
||||
int32 darker;
|
||||
float ratio;
|
||||
|
||||
do {
|
||||
foreground.set_to(rand() % 255, rand() % 255, rand() %255);
|
||||
if (foreground.Brightness() > background.Brightness()) {
|
||||
brighter = foreground.Brightness();
|
||||
darker = background.Brightness();
|
||||
}
|
||||
else {
|
||||
brighter = background.Brightness();
|
||||
darker = foreground.Brightness();
|
||||
}
|
||||
ratio = (brighter + .05) / (darker + .05);
|
||||
}
|
||||
while (ratio > 5 || ratio < 4);
|
||||
|
||||
return foreground;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ReadAttributeData(BNode* node, const char* name, char** buffer, int32 *size) {
|
||||
attr_info info;
|
||||
|
|
|
@ -25,6 +25,7 @@ const char* CayaCachePath();
|
|||
const char* CayaLogPath(const char* signature, const char* subsignature);
|
||||
|
||||
rgb_color CayaTintColor(rgb_color color, int severity);
|
||||
rgb_color CayaForegroundColor(rgb_color background);
|
||||
|
||||
// Borrowed from BePodder's own libfunky
|
||||
status_t ReadAttributeData(BNode* node, const char* name, char** buffer, int32 *size);
|
||||
|
|
|
@ -29,6 +29,7 @@ User::User(BString id, BMessenger msgn)
|
|||
fMessenger(msgn),
|
||||
fLooper(NULL),
|
||||
fListItem(NULL),
|
||||
fItemColor(CayaForegroundColor(ui_color(B_LIST_BACKGROUND_COLOR))),
|
||||
fStatus(CAYA_OFFLINE),
|
||||
fPopUp(NULL)
|
||||
{
|
||||
|
|
|
@ -63,6 +63,8 @@ public:
|
|||
|
||||
ChatMap Conversations();
|
||||
|
||||
rgb_color fItemColor;
|
||||
|
||||
protected:
|
||||
BMessenger fMessenger;
|
||||
ProtocolLooper* fLooper;
|
||||
|
|
Ŝarĝante…
Reference in New Issue