You have the ability to customize the look and feel of the template. How much customization is available depends on the RPC version of the head unit you are connected with as well as the design of the HMI.
You can customize the color scheme of your app using template coloring APIs.
You can change the template colors of the initial template layout in the lifecycleConfiguration
.
SDLRGBColor *green = [[SDLRGBColor alloc] initWithRed:126 green:188 blue:121]; SDLRGBColor *white = [[SDLRGBColor alloc] initWithRed:249 green:251 blue:254]; SDLRGBColor *darkGrey = [[SDLRGBColor alloc] initWithRed:57 green:78 blue:96]; SDLRGBColor *grey = [[SDLRGBColor alloc] initWithRed:186 green:198 blue:210]; lifecycleConfiguration.dayColorScheme = [[SDLTemplateColorScheme alloc] initWithPrimaryRGBColor:green secondaryRGBColor:grey backgroundRGBColor:white]; lifecycleConfiguration.nightColorScheme = [[SDLTemplateColorScheme alloc] initWithPrimaryRGBColor:green secondaryRGBColor:grey backgroundRGBColor:darkGrey];
let green = SDLRGBColor(red: 126, green: 188, blue: 121) let white = SDLRGBColor(red: 249, green: 251, blue: 254) let grey = SDLRGBColor(red: 186, green: 198, blue: 210) let darkGrey = SDLRGBColor(red: 57, green: 78, blue: 96) lifecycleConfiguration.dayColorScheme = SDLTemplateColorScheme(primaryRGBColor: green, secondaryRGBColor: grey, backgroundRGBColor: white) lifecycleConfiguration.nightColorScheme = SDLTemplateColorScheme(primaryRGBColor: green, secondaryRGBColor: grey, backgroundRGBColor: darkGrey)
You may only change the template coloring once per template; that is, you cannot call changeLayout
, SetDisplayLayout
or Show
for the template you are already on and expect the color scheme to update.
You can change the template color scheme when you change layouts. This guide requires SDL iOS version 7.0. If using an older version, use SDLSetDisplayLayout
(any RPC version) or SDLShow
(RPC v6.0+) request.
SDLRGBColor *green = [[SDLRGBColor alloc] initWithRed:126 green:188 blue:121]; SDLRGBColor *white = [[SDLRGBColor alloc] initWithRed:249 green:251 blue:254]; SDLRGBColor *darkGrey = [[SDLRGBColor alloc] initWithRed:57 green:78 blue:96]; SDLRGBColor *grey = [[SDLRGBColor alloc] initWithRed:186 green:198 blue:210]; SDLTemplateConfiguration *config = [[SDLTemplateConfiguration alloc] initWithTemplate:SDLPredefinedLayoutGraphicWithText dayColorScheme:[[SDLTemplateColorScheme alloc] initWithPrimaryRGBColor:green secondaryRGBColor:grey backgroundRGBColor:white] nightColorScheme:[[SDLTemplateColorScheme alloc] initWithPrimaryRGBColor:green secondaryRGBColor:grey backgroundRGBColor:darkGrey]]; [self.sdlManager.screenManager changeLayout:config withCompletionHandler:^(NSError * _Nullable error) { if (error != nil) { // Color set with template change } else { // Color and template not changed } }];
let green = SDLRGBColor(red: 126, green: 188, blue: 121) let white = SDLRGBColor(red: 249, green: 251, blue: 254) let grey = SDLRGBColor(red: 186, green: 198, blue: 210) let darkGrey = SDLRGBColor(red: 57, green: 78, blue: 96) let config = SDLTemplateConfiguration(template: .graphicWithText, dayColorScheme: SDLTemplateColorScheme(primaryRGBColor: green, secondaryRGBColor: grey, backgroundRGBColor: white), nightColorScheme: SDLTemplateColorScheme(primaryRGBColor: green, secondaryRGBColor: grey, backgroundRGBColor: darkGrey)) sdlManager.screenManager.changeLayout(config) { err in if let error = err { // Color and template not changed } else { // Color set with template change } }
You can also customize the title and icon of the main menu button that appears on your template layouts. The menu icon must first be uploaded with a specific name through the file manager; see the Uploading Images section for more information on how to upload your image.
SDLSetGlobalProperties *setGlobals = [[SDLSetGlobalProperties alloc] init]; setGlobals.menuTitle = @"<#Custom Title#>"; // The image must be uploaded before referencing the image name here setGlobals.menuIcon = [[SDLImage alloc] initWithName:@"<#Custom Icon Name#>" isTemplate:YES]; [self.sdlManager sendRequest:setGlobals withResponseHandler:^(SDLRPCRequest *request, SDLRPCResponse *response, NSError *error) { if (error != nil) { // Something went wrong } // The menu title and icon should be updated }];
let setGlobals = SDLSetGlobalProperties() setGlobals.menuTitle = "<#Custom Title#>" // The image must be uploaded before referencing the image name here setGlobals.menuIcon = SDLImage(name: "<#Custom Icon Name#>", isTemplate: true) sdlManager.send(request: setGlobals) { (request, response, error) in if error != nil { // Something went wrong } // The menu title and icon should be updated }