Skip to main content

Default Theme

The theme object is where you define your application's color palette, type scale, borders, border radius values, and more.

info

First of all you need to install @flexnative/theme-context. Fallow instructions here on how to install and how to use @flexnative/theme-context.

Properties

BaseTheme<TColors>

Interface representing the base theme structure. TColors - @template for Custom colors that extend the base colors.

NameTypeRequiredDefault ValueDescription
colorsBaseColors & TColorstrueBaseColorsDefault theme colors. You can add whatever values you want to the theme, and they will be merged with the default.
schemeColorSchemeNamefalseDevice color scheme.Theme color scheme. ColorSchemeName
borderWidthRecord<BorderWidth, number>trueBorderWidthBorder width used by components.
borderRadiusRecord<BorderRadius, number>trueBorderRadiusBorder radius used by components.
fontSizeRecord<FontSize, number>trueFontSizeFont size used by components.
metricsobjecttruemetricsBase constants values used by components.

BaseColors

Default theme colors. You can add whatever values you want to the theme, and they will be merged with the default.

Color

Represents the possible color options for a component. The available color options are: 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | ColorValue

NameTypeRequiredLight ValueDark Value
whiteColorValuetrue #FFFFFF #FFFFFF
blackColorValuetrue #424242 #424242
backgroundColorValuetrue #f8f8f8 #000000
defaultColorValuetrue #f5f5f5 #404040
cardColorValuetrue #ffffff #232323
textColorValuetrue #424242 #ffffff
borderColorValuetrue #42424226 #ffffff1A
placeholderColorValuetrue #0000001A #FFFFFF1A
infoColorValuetrue #3e80ed #3e80ed
successColorValuetrue #5ec232 #5ec232
warningColorValuetrue #ffc107 #ffc107
errorColorValuetrue #d51923 #d51923
darkColorValuetrue #424242 #424242
secondaryColorValuetrue #666666 #5C5C5C
lightColorValuetrue #ebebeb #ebebeb
primaryColorValuetrue #ff6358 #ff6358
overlayColorValuetrue #00000021 #FFFFFF21

BorderWidth

Border width used by components. One of 'none' | 'hairline' | 'thin' | 'base' | 'thick' | number

NameTypeValue
nonenumber0
hairlinenumberThis is defined as the width of a thin line on the platform. It can be used as the thickness of a border or division between two elements. StyleSheet.hairlineWidth
thinnumber1
basenumber2
thicknumber3

BorderRadius

Border radius used by components. One of 'none' | 'small' | 'medium' | 'large' | 'full' | number

NameTypeValue
nonenumber0
smallnumber2
mediumnumber4
largenumber6
fullnumber99999

FontSize

Font size used by components. One of 'small' | 'default' | 'medium' | 'large' | number

NameTypeValue
smallnumbermetrics.baseSize * 0.75
defaultnumbermetrics.baseSize
mediumnumbermetrics.baseSize * 1.25
largenumbermetrics.baseSize * 1.5

metrics

Base constants values used by components.

NameTypeValueDescription
baseSizenumber16Base size used in fontSize.
disabledOpacitynumber0.4Opacity style property value for disabled components.
ghostOpacitystring40Color opacity for components with 'ghost' appearance.
verticalMultipliernumber0.6A constant multiplayer for components vertical padding.
horizontalMultipliernumber1A constant multiplayer for components horizontal padding.

Sizes

Represents the possible sizes for a component. One of 'small' | 'medium' | 'large' | number

note

Sizes are used by components to define their size. In different components, the size values may have different values.