Using Hex Colors for Closed Caption

Using Hex Colors for Closed Caption

Environment: Android/ Java/ aTVSDK

Staring Android TVSDK 2.x programmers are now able to set caption colors using hex values

Color Settings: An enhancement was made to color styling of closed captions. The enhancement allows for setting closed caption colors using a hex string representing RGB color values. The RGB hex color representation is the familiar 6 byte string you use in applications such as Photoshop: 

• FFFFFF = Black 
• 000000 = White 
• FF0000 = Red 
• 00FF00 = Green 
• 0000FF = Blue 

There is an enumeration set to the value 0xff000000. One must add 24 bit RGB value to this enumeration.

This is how you should use the hex colors -

1. Create a new TextFormatBuilder object:

TextFormatBuilder tfB new TextFormatBuilder();

2. Use the Hex color values in TextFormatBuilder class's setter methods:

tfB.setFontColor("0x00FF00"); //00FF00 - Hex for Green
tfB.setBackgroundColor("0xFF0000"); //FF0000 - Hex for Red

3. Now, attach this new color style to the player anytime after it is prepared using setCCStyle method:


Refer the programming guide for 2.5: