Print Page | Close Window

Make font color light if background color is dark

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=14298
Printed Date: 01 June 2025 at 8:38pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Make font color light if background color is dark
Posted By: DataFlowJoe
Subject: Make font color light if background color is dark
Date Posted: 14 May 2009 at 10:49am
Hi guys...
 
Is it possible to change the font colour of the calendar events so that the text appears lighter if the label background colour is dark.
 
Ideally I'd like the foreground colour to change to a lighter colour if the background is too dark to support black text. 
 
Thanks in advance


-------------
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)



Replies:
Posted By: DataFlowJoe
Date Posted: 14 May 2009 at 6:37pm
Hi Guys,
 
I've found out from another forum how to get the inverse color to enable contrast with darker backgrounds ... in VB it's done using the following code...
 
Function GetContrastColor(lngParamColor ) As Long

    GetContrastColor = Not lngParamColor And &HFFFFFF

End Function
 
I now want to implement this but I can't get the BeforeDrawThemeObject event to trigger. I've set it to fire for all flags but it's not getting fired ...
 
 
I guess I need to use this event to change the text color to contrast whatever colour the Event background has been set to.
 
Any help will be greatly appreciated.
 
Thanks


-------------
He is no fool who gives what he cannot keep to gain what he cannot lose. (Jim Elliott)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net