Defining Text Color
 
Notifications
Clear all

Defining Text Color

6 Posts
3 Users
0 Reactions
3,230 Views
(@furkanksck)
New Member
Joined: 3 years ago
Posts: 3
Topic starter  

I'm trying to write a code that changes font color when the spesified result. I tried if([DataCorePlugin.GameData.TyreTemperatureRearRightInner],fontcolor(#FF008000),0). But this code didn't work and actually I dont know how to write a code so I need help. Thanks for reading


   
Quote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

Hi,
There are multiple ways to do this.

Using a "Computed value" (if you want hard thresholds for the color changes)
if( [DataCorePlugin.GameData.TyreTemperatureRearRightInner]<80, '#FF0000FF', '#FF008000')

You can replace the hexcodes by the color names if applicable:
if( [DataCorePlugin.GameData.TyreTemperatureRearRightInner]<80, 'Blue', 'Red')

And you can use nested ifs if you want more than 2 colors:
if( [DataCorePlugin.GameData.TyreTemperatureRearRightInner]<80, 'Blue',
if( [DataCorePlugin.GameData.TyreTemperatureRearRightInner]>90, 'Red', 'Green'))

If you want the color to gradually change, use "Computed color" instead
Simply insert your property as formula and set your colors and thresholds.


   
ReplyQuote
(@furkanksck)
New Member
Joined: 3 years ago
Posts: 3
Topic starter  

Thank you so much. I've done it with your help thank you really. But I still have an issue with something.
if([DataCorePlugin.GameData.TyreTemperatureRearLeftInner]<80,'SteelBlue',
if(104>[DataCorePlugin.GameData.TyreTemperatureRearLeftInner]> 109,'Orange',
if([DataCorePlugin.GameData.TyreTemperatureRearLeftInner]>110,'Red','Green')))
I writed that but it doesnt read between part. Trying to do that if the tyre temp is in between 104-109, font color should be orange. Thanks for your help again 🙂


   
ReplyQuote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

Replace
104>[DataCorePlugin.GameData.TyreTemperatureRearLeftInner]> 109
With
[DataCorePlugin.GameData.TyreTemperatureRearLeftInner] > 104 && [DataCorePlugin.GameData.TyreTemperatureRearLeftInner] < 109


   
ReplyQuote
(@furkanksck)
New Member
Joined: 3 years ago
Posts: 3
Topic starter  

Thank you


   
ReplyQuote
(@mafiaboss)
New Member
Joined: 2 years ago
Posts: 1
 

Im looking to do something like the post but with SafetyRating!
I want to apply 3 colors of text for safety rating like as follows
0-2 is is red
2.1-3.3 is orange
3.4 up is black

This way without even taking the time to read a number, just by color I know "oh need to be careful around this guy"

currently text binding is
 [IRacingExtraProperties.iRacing_DriverBehind_00_SafetyRating]

Then I have the same but for driverAhead

I just need to understand how I go about the textColor binding but in my own method.

Thanks for any info and time!


   
ReplyQuote
Share: