Converting LFS Colours
Live for Speed text that includes colours is encoded. This guide will help you to extract the colours from the text.
Imagine you made a call to the User Profile API and wanted to decode the following nickname: "nickname": "^1[TC]\u00bbPete\u00ab",
. The UTF-8 encoding is not an issue because the browser decodes that automatically for us but the LFS colour prefixes eg. ^1
, will need to be decoded by us before being presented.
Our code examples are available in JavaScript and PHP (change language in the top right).
Reference Implementations
The list of LFS colour codes is as follows:
Colour | Code |
Black |
|
Red |
|
Light Green |
|
Yellow |
|
Blue |
|
Purple |
|
Light Blue |
|
White |
|
Dark Green (Default) |
|
Original text colour and codepage |
|
All of the examples in this guide require the following CSS to properly display the colours:
CSS
Last updated