Skip to main content

Theming

In order to fit the Docutain Xamarin Scanner SDK into your corporate design, you have a bunch of options to alter the default theme of the ready to use UI components of the document scanner.

Color Theming

The following is a list of all color attributes currently supported.

public (Color Light, Color Dark)? ColorPrimary;
public (Color Light, Color Dark)? ColorSecondary;
public (Color Light, Color Dark)? ColorOnSecondary;
public (Color Light, Color Dark)? ColorScanButtonsLayoutBackground;
public (Color Light, Color Dark)? ColorScanButtonsForeground;
public (Color Light, Color Dark)? ColorScanPolygon;
public (Color Light, Color Dark)? ColorBottomBarBackground;
public (Color Light, Color Dark)? ColorBottomBarForeground;
public (Color Light, Color Dark)? ColorTopBarBackground;
public (Color Light, Color Dark)? ColorTopBarForeground;

Detailed explanation

ColorPrimary is used to tint progress indicators and dialog buttons.

theming_dialog_button theming_progress_indicators


ColorSecondary is used to tint selectable controls and the capture button.

theming_selection_controls theming_capture_button


ColorOnSecondary is used to tint elements that reside on ColorSecondary, like the icon of the capture button.

theming_capture_button


ColorScanButtonsLayoutBackground is used to tint the background of the layout containing the buttons of the scan layout, like the capture button or torch button.

theming_scan_buttons_layout


ColorScanButtonsForeground is used to tint the foreground of the buttons of the scan layout, like the torch button.

theming_scan_buttons_layout


ColorScanPolygon is used to tint the polygon overlay which highlights the currently detected document.

theming_scan_polygon


ColorBottomBarBackground is used to tint the bottom toolbar background of the image editing page.

theming_edit_bottombar


ColorBottomBarForeground is used to tint the buttons within the bottom toolbar of the image editing page.

theming_edit_bottombar


ColorTopBarBackground is used to tint the top toolbar background.

theming_topbar


ColorTopBarForeground is used to tint the elements contained in the top toolbar, like buttons and titles.

theming_topbar


Defining a custom theme

In order to alter at least one of the colors mentioned above, you need to pass it to the DocumentScannerConfiguration which is used to start the document scanner.

The following is an example which alters all currently available colors.

using Docutain.SDK.Xamarin.Forms;

var config = new DocumentScannerConfiguration();
//define your colors
config.ColorConfig.ColorPrimary = (Color.Purple, Color.Purple);
config.ColorConfig.ColorSecondary = (Color.Purple, Color.Purple);
config.ColorConfig.ColorOnSecondary = (Color.White, Color.Black);
config.ColorConfig.ColorScanButtonsLayoutBackground = (Color.White, Color.Black);
config.ColorConfig.ColorScanButtonsForeground = (Color.Black, Color.White);
config.ColorConfig.ColorScanPolygon = (Color.Purple, Color.Purple);
config.ColorConfig.ColorBottomBarBackground = (Color.Purple, Color.Black);
config.ColorConfig.ColorBottomBarForeground = (Color.White, Color.White);
config.ColorConfig.ColorTopBarBackground = (Color.Purple, Color.Black);
config.ColorConfig.ColorTopBarForeground = (Color.White, Color.White);
//start the scanner
await UI.ScanDocument(config);

Dark Mode

The Docutain Scanner SDK also supports dark mode theming. This is why each color has a Light and a Dark version.

public (Color Light, Color Dark)? ColorPrimary;

The colors will be automatically picked up based on the device setting. If it is currently in dark mode, the Docutain SDK will use the Dark versions of the colors, otherwise it will use the Light versions.

theming_edit_bottombar theming_edit_bottombar_dark

Document Scan Onboarding

If a user opens the document scanner for the first time, an onboarding dialog appears. The displayed image can be customized by setting the OnboardingImageSource of the DocumentScannerConfiguration. For Android it needs to be the name of an image in your drawable folder. For iOS it needs to be the name of an image in your assets catalog. In both cases do not include file extension.

var config = new DocumentScannerConfiguration();
//define your custom onboarding image
config.OnboardingImageSource = "your_custom_image";
//start the scanner
await UI.ScanDocument(config);
caution

If you are using a custom image, you are responsible to test whether the dialog layout is fine.

theming_edge_detection_dialog