ATVO by Appgineering
Download
Read-only

Colored names in overlays

3 posts 2,769 views Started 18 Oct 2020, 03:41
Showing 1–3 of 3 posts
Charles C.
Original poster

Is there a way with a script that I can put drivers ID into it and make it so that when it sees that ID anywhere in the overlays it will change their name to the color I set in the script? I am wanting to do this as I have some leagues that use playoffs and this would be handy to have so fans would know who is in the playoffs.

Nick Thissen Appgineering
Reply #1

There are several easy ways but the core is the "Override Font Color" property of any label. This allows you to data-bind the font color. You can use a Spreadsheet item where a column contains the desired color (hex code for example), and bind the Override Font Color to that column. Or you can use a column that simply says "1" or "true" or something to indicate that this driver is a playoff driver, and put the color in the converter script.

In each case, you need to also specify a converter script. Even if you put the color hex code in the spreadsheet, the data binding unfortunately does not understand that it represents a color so you still have to convert it to a color with a script. That script is very simple and can just take a string as input (e.g hex color, or even names like "Red") and convert it with ColorConverter:

using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using System.Windows.Media;

namespace Scripts
{
	public class ConvertToColor : IScript
	{
		public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
		{	
			if (value == null)
				return null;
					
			var colorString = value.ToString();
			return (Color)ColorConverter.ConvertFromString(colorString);
		}
	}
}
Archive · Read-only

New replies have moved to Discord.