Expert Guide

Advanced configuration for AI optimizers and complex systems.

Customizing Components

Fentrica web components are built to be easily customized and modified to fit your brand. All components are themed using CSS variables, configured via a global JavaScript object, and translated using i18next.

Theming with CSS Variables

CSS variables allow you to change colors, fonts, and backgrounds across all components without modifying source code. Set them on :root or scope them to a specific container.

Colors

Components have 9 default color palettes. Each color can be used through component color parameters (e.g. color="primary").

ColorUsage
primaryMain brand color, used for primary actions and highlights
secondarySecondary brand color
tertiaryTertiary accent color
successPositive states, confirmations
warningCaution states, non-critical alerts
dangerError states, destructive actions
darkDark UI elements
mediumNeutral, muted elements
lightLight UI elements

Layered Color Properties

Each color consists of six CSS variables — a base, contrast, shade, and tint — that must all be set together when overriding:

PropertyVariableDescription
Base--lar-color-{name}The base color in hex
Base (RGB)--lar-color-{name}-rgbThe base color as comma-separated RGB values
Contrast--lar-color-{name}-contrastText/icon color visible against the base
Contrast (RGB)--lar-color-{name}-contrast-rgbThe contrast color as comma-separated RGB values
Shade--lar-color-{name}-shadeA slightly darker version of the base
Tint--lar-color-{name}-tintA slightly lighter version of the base

When overriding a color, set all six variables. Omitting any of them may cause inconsistent rendering in components that rely on shade, tint, or contrast variants.

Example: Changing the secondary color to green

:root {
  --lar-color-secondary: #006414;
  --lar-color-secondary-rgb: 0, 100, 20;
  --lar-color-secondary-contrast: #ffffff;
  --lar-color-secondary-contrast-rgb: 255, 255, 255;
  --lar-color-secondary-shade: #005414;
  --lar-color-secondary-tint: #007414;
}

Default Color Values

ColorDefault hexContrast
primary#780bb7#ffffff
secondary#7fb800#ffffff
tertiary#00a6ed#ffffff
success#7fb800#ffffff
warning#ffb400#000000
danger#f6511d#ffffff
light#f4f5f8#000000
medium#d6d6d6#000000
dark#222428#ffffff

Application Theme Variables

Global CSS variables that control the overall appearance:

VariableDefaultDescription
--lar-background-color#000Base background color
--lar-text-color#fffDefault text color
--lar-backdrop-color#000Overlay/backdrop color for modals and sheets
--lar-font-family"Helvetica Neue", "Roboto", sans-serifFont family for all component text

Background & Text Color Steps

Background and text colors each have 20 stepped shades (from step-50 to step-1000 in increments of 50) used for layered surfaces and text opacity levels:

Variable patternDescription
--lar-background-color-step-{50..1000}Stepped background shades — lower values are closer to background, higher values step toward text color
--lar-text-color-step-{50..1000}Stepped text shades — lower values are closer to text color, higher values step toward background

Example: Dark theme override

:root {
  --lar-background-color: #1a1a2e;
  --lar-background-color-step-50: #1f1f35;
  --lar-background-color-step-100: #24243c;
  --lar-text-color: #e0e0e0;
  --lar-font-family: 'Inter', sans-serif;
}

Backdrop & Effects

VariableDefaultDescription
--lar-backdrop-opacity0.92Backdrop overlay opacity
--lar-ios-blur10pxiOS-style blur effect on backdrops

Node Component Variables

Nodes are the primary UI building blocks — each device control (switch, slider, sensor) renders as a node.

Node Box

VariableDefaultDescription
--lar-node-box-height10remStandard node card height
--lar-node-box-border-radius0.5remNode card corner radius
--lar-node-small-box-height4remSmall node card height
--lar-node-small-box-border-radius0.5remSmall node card corner radius

Node Margins

VariableDefaultDescription
--lar-node-margin-top1remNode top margin
--lar-node-margin-right1remNode right margin
--lar-node-margin-bottom1remNode bottom margin
--lar-node-margin-left1remNode left margin

Node Icon

VariableDefaultDescription
--lar-node-icon-size3remStandard icon size
--lar-node-icon-border-radius50%Icon border radius
--lar-node-icon-padding-top1.2remIcon container padding (top)
--lar-node-icon-padding-right1.2remIcon container padding (right)
--lar-node-icon-padding-bottom1.2remIcon container padding (bottom)
--lar-node-icon-padding-left1.2remIcon container padding (left)
--lar-node-small-icon-size1.8remSmall icon size
--lar-node-small-icon-padding-top0.5remSmall icon padding (top)
--lar-node-small-icon-padding-right0.5remSmall icon padding (right)
--lar-node-small-icon-padding-bottom0.5remSmall icon padding (bottom)
--lar-node-small-icon-padding-left0.5remSmall icon padding (left)

Node Status Badge (Small Icon)

VariableDefaultDescription
--lar-node-icon-small-size1.7remStatus badge icon size
--lar-node-icon-small-border-radius0.4remStatus badge corner radius
--lar-node-icon-small-border-width0.3remStatus badge border width
--lar-node-icon-small-border-stylesolidStatus badge border style
--lar-node-icon-small-border-colorbackground colorStatus badge border color
--lar-node-icon-small-top-0.85remStatus badge position (top)
--lar-node-icon-small-left-0.85remStatus badge position (left)
--lar-node-icon-small-padding-*0.6remStatus badge padding (top/right/bottom/left)

Node Typography

VariableDefaultDescription
--lar-node-value-font-size1.3remNode value display font size

Node Camera / Video Overlay

VariableDescription
--lar-node-cam-text-topCamera text overlay position (top)
--lar-node-cam-text-rightCamera text overlay position (right)
--lar-node-cam-text-bottomCamera text overlay position (bottom)
--lar-node-cam-text-leftCamera text overlay position (left)
--lar-node-cam-text-font-sizeCamera text overlay font size
--lar-node-cam-text-max-widthCamera text overlay max width
--lar-node-cam-text-max-heightCamera text overlay max height
--lar-node-cam-modal-text-topModal camera text position (top)
--lar-node-cam-modal-text-rightModal camera text position (right)
--lar-node-cam-modal-text-bottomModal camera text position (bottom)
--lar-node-cam-modal-text-leftModal camera text position (left)
VariableDefaultDescription
--lar-modal-padding-top2remModal content padding (top)
--lar-modal-padding-right1remModal content padding (right)
--lar-modal-padding-bottom1.3remModal content padding (bottom)
--lar-modal-padding-left1remModal content padding (left)
--lar-modal-big-icon-size4remLarge icon size in modals
--lar-modal-small-icon-size1.5remSmall icon size in modals
--lar-modal-value-font-size2.2remValue display font size in modals
--lar-modal-blur3pxModal background blur
--lar-modal-header-opacity0.8Modal header opacity
--lar-modal-info-opacity0.8Modal info section opacity
--lar-modal-icon-box-shadowBox shadow for modal header icons

Button Variables

VariableDefaultDescription
--lar-button-border-radius0.6remButton corner radius
--lar-button-padding-top1remButton padding (top)
--lar-button-padding-right1remButton padding (right)
--lar-button-padding-bottom1remButton padding (bottom)
--lar-button-padding-left1remButton padding (left)
--lar-button-font-size1.2remButton font size
--lar-button-border-radius-small0.6remSmall button corner radius
--lar-button-padding-top-small0.6remSmall button padding (top)
--lar-button-padding-right-small0.6remSmall button padding (right)
--lar-button-padding-bottom-small0.6remSmall button padding (bottom)
--lar-button-padding-left-small0.6remSmall button padding (left)
--lar-button-font-size-small1remSmall button font size

Badge Variables

VariableDefaultDescription
--lar-badge-padding-top0.15remBadge padding (top)
--lar-badge-padding-right0.25remBadge padding (right)
--lar-badge-padding-bottom0.15remBadge padding (bottom)
--lar-badge-padding-left0.25remBadge padding (left)
--lar-badge-border-radius0.2remBadge corner radius

List Variables

VariableDefaultDescription
--lar-list-item-padding-top0.5remList item padding (top)
--lar-list-item-padding-right0.5remList item padding (right)
--lar-list-item-padding-bottom0.5remList item padding (bottom)
--lar-list-item-padding-left0.5remList item padding (left)

Icon Variables

VariableDefaultDescription
--lar-icon-size-small1remSmall icon size
--lar-icon-size-medium1.5remMedium icon size
--lar-icon-size-large2remLarge icon size

Notification Variables

VariableDefaultDescription
--lar-notify-padding-top1remNotification padding (top)
--lar-notify-padding-right1remNotification padding (right)
--lar-notify-padding-bottom1remNotification padding (bottom)
--lar-notify-padding-left1remNotification padding (left)
--lar-notify-border-radius0.5remNotification corner radius
--lar-notify-font-size1remNotification font size
--lar-notify-line-height1.5Notification line height
--lar-notify-backdrop-filterblur(8px)Notification backdrop blur
--lar-notify-box-shadow0 4px 6px -1px rgb(0 0 0 / 0.1), ...Notification box shadow

Push Button Variables

VariableDescription
--lar-push-button-sizeStandard push button size
--lar-push-button-size-smallSmall push button size

Global Configuration

Components use a global configuration object bound to window.Larva.config. This lets you control animations, date formats, and other runtime behavior.

Setting Configuration

Set default values before components are loaded:

window.Larva = {
  config: {
    animated: true,
    swipeBack: true,
  }
};

After components are loaded, the config object is converted to a getter/setter interface:

// Disable animations at runtime
window.Larva.config.set('animated', false);

// Read current value
window.Larva.config.get('animated'); // false

URL Query Overrides

Configuration can also be overridden via URL query parameters using the larva: prefix:

https://your-app.com/?larva:animated=false&larva:swipeBack=false

Configuration Properties

PropertyTypeDefaultDescription
animatedbooleantrueEnable or disable component animations
swipeBackbooleantrueEnable swipe-back gesture for node modals
formatDateTimestringDD.MM.YYYY HH:mmLong date and time format
formatLongDatestringDD.MM.YYYYLong date format
formatShortDatestringDD.MM.YYYYShort date format
formatLongTimestringHH:mmLong time format
formatShortTimestringHH:mmShort time format
videoproxyURLstringws(s)://hostname:port/pathRTSP/H264 and HTTP/MJPEG WebSocket proxy URL for the lar-rtsp-h264-mjpeg video component

Translations

Components use i18next for internationalization. The i18next instance is bound to window.Larva.i18n, giving you full control over translations.

Adding Translations

window.Larva.i18n.addResourceBundle('en', 'namespace1', {
  key: 'hello from namespace 1'
});

Changing Language

window.Larva.i18n.changeLanguage('en', (err, t) => {
  if (err) return console.error('Language change failed:', err);
  console.log('Language changed successfully');
});

All component titles and labels pass through the i18next translation pipeline. To customize any text shown by a component, add the corresponding translation key to your resource bundle.

Default Translation Keys

The default English translation bundle contains all keys used by components. Use it as a reference when adding new languages or overriding specific labels:

View default English bundle

For the full i18next API (namespaces, interpolation, plurals, etc.), see the i18next documentation.