application-amicale/native-base-theme/variables/material.js

305 lines
6.4 KiB
JavaScript
Raw Normal View History

2019-06-25 22:20:24 +02:00
// @flow
2020-01-28 20:07:21 +01:00
import color from 'color';
import { Platform, Dimensions, PixelRatio } from 'react-native';
2019-06-25 22:20:24 +02:00
2020-01-28 20:07:21 +01:00
import { PLATFORM } from './commonColor';
2019-06-25 22:20:24 +02:00
2020-01-28 20:07:21 +01:00
const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;
2019-06-25 22:20:24 +02:00
const platform = Platform.OS;
2020-01-28 20:07:21 +01:00
const platformStyle = PLATFORM.MATERIAL;
2019-06-25 22:20:24 +02:00
const isIphoneX =
2020-01-28 20:07:21 +01:00
platform === PLATFORM.IOS &&
(deviceHeight === 812 ||
deviceWidth === 812 ||
deviceHeight === 896 ||
deviceWidth === 896);
2019-06-25 22:20:24 +02:00
export default {
platformStyle,
platform,
2020-01-28 20:07:21 +01:00
// Accordion
headerStyle: '#edebed',
iconStyle: '#000',
contentStyle: '#f5f4f5',
expandedIconStyle: '#000',
accordionBorderColor: '#d3d3d3',
// ActionSheet
elevation: 4,
containerTouchableBackgroundColor: 'rgba(0,0,0,0.4)',
innerTouchableBackgroundColor: '#fff',
listItemHeight: 50,
listItemBorderColor: 'transparent',
marginHorizontal: -15,
marginLeft: 14,
marginTop: 15,
minHeight: 56,
padding: 15,
touchableTextColor: '#757575',
2019-06-25 22:20:24 +02:00
// Android
androidRipple: true,
2020-01-28 20:07:21 +01:00
androidRippleColor: 'rgba(256, 256, 256, 0.3)',
androidRippleColorDark: 'rgba(0, 0, 0, 0.15)',
buttonUppercaseAndroidText: true,
2019-06-25 22:20:24 +02:00
// Badge
2020-01-28 20:07:21 +01:00
badgeBg: '#ED1727',
badgeColor: '#fff',
2019-06-25 22:20:24 +02:00
badgePadding: 0,
// Button
2020-01-28 20:07:21 +01:00
buttonFontFamily: 'Roboto',
buttonDisabledBg: '#b5b5b5',
2019-06-25 22:20:24 +02:00
buttonPadding: 6,
2020-01-28 20:07:21 +01:00
get buttonPrimaryBg() {
2019-06-25 22:20:24 +02:00
return this.brandPrimary;
},
2020-01-28 20:07:21 +01:00
get buttonPrimaryColor() {
2019-06-25 22:20:24 +02:00
return this.inverseTextColor;
},
2020-01-28 20:07:21 +01:00
get buttonInfoBg() {
2019-06-25 22:20:24 +02:00
return this.brandInfo;
},
2020-01-28 20:07:21 +01:00
get buttonInfoColor() {
2019-06-25 22:20:24 +02:00
return this.inverseTextColor;
},
2020-01-28 20:07:21 +01:00
get buttonSuccessBg() {
2019-06-25 22:20:24 +02:00
return this.brandSuccess;
},
2020-01-28 20:07:21 +01:00
get buttonSuccessColor() {
2019-06-25 22:20:24 +02:00
return this.inverseTextColor;
},
2020-01-28 20:07:21 +01:00
get buttonDangerBg() {
2019-06-25 22:20:24 +02:00
return this.brandDanger;
},
2020-01-28 20:07:21 +01:00
get buttonDangerColor() {
2019-06-25 22:20:24 +02:00
return this.inverseTextColor;
},
2020-01-28 20:07:21 +01:00
get buttonWarningBg() {
2019-06-25 22:20:24 +02:00
return this.brandWarning;
},
2020-01-28 20:07:21 +01:00
get buttonWarningColor() {
2019-06-25 22:20:24 +02:00
return this.inverseTextColor;
},
2020-01-28 20:07:21 +01:00
get buttonTextSize() {
2019-06-25 22:20:24 +02:00
return this.fontSizeBase - 1;
},
2020-01-28 20:07:21 +01:00
get buttonTextSizeLarge() {
2019-06-25 22:20:24 +02:00
return this.fontSizeBase * 1.5;
},
2020-01-28 20:07:21 +01:00
get buttonTextSizeSmall() {
2019-06-25 22:20:24 +02:00
return this.fontSizeBase * 0.8;
},
get borderRadiusLarge() {
return this.fontSizeBase * 3.8;
},
get iconSizeLarge() {
return this.iconFontSize * 1.5;
},
get iconSizeSmall() {
return this.iconFontSize * 0.6;
},
// Card
2020-01-28 20:07:21 +01:00
cardDefaultBg: '#fff',
cardBorderColor: '#ccc',
2019-06-25 22:20:24 +02:00
cardBorderRadius: 2,
2020-01-28 20:07:21 +01:00
cardItemPadding: platform === PLATFORM.IOS ? 10 : 12,
2019-06-25 22:20:24 +02:00
// CheckBox
CheckboxRadius: 0,
CheckboxBorderWidth: 2,
CheckboxPaddingLeft: 2,
CheckboxPaddingBottom: 5,
CheckboxIconSize: 16,
CheckboxIconMarginTop: 1,
CheckboxFontSize: 17,
2020-01-28 20:07:21 +01:00
checkboxBgColor: '#039BE5',
2019-06-25 22:20:24 +02:00
checkboxSize: 20,
2020-01-28 20:07:21 +01:00
checkboxTickColor: '#fff',
2019-06-25 22:20:24 +02:00
// Color
2020-01-28 20:07:21 +01:00
brandPrimary: '#3F51B5',
brandInfo: '#62B1F6',
brandSuccess: '#5cb85c',
brandDanger: '#d9534f',
brandWarning: '#f0ad4e',
brandDark: '#000',
brandLight: '#f4f4f4',
// Container
containerBgColor: '#fff',
2019-06-25 22:20:24 +02:00
2020-01-28 20:07:21 +01:00
// Date Picker
datePickerTextColor: '#000',
datePickerBg: 'transparent',
2019-06-25 22:20:24 +02:00
2020-01-28 20:07:21 +01:00
// FAB
fabWidth: 56,
2019-06-25 22:20:24 +02:00
// Font
DefaultFontSize: 16,
2020-01-28 20:07:21 +01:00
fontFamily: 'Roboto',
2019-06-25 22:20:24 +02:00
fontSizeBase: 15,
get fontSizeH1() {
return this.fontSizeBase * 1.8;
},
get fontSizeH2() {
return this.fontSizeBase * 1.6;
},
get fontSizeH3() {
return this.fontSizeBase * 1.4;
},
// Footer
footerHeight: 55,
2020-01-28 20:07:21 +01:00
footerDefaultBg: '#3F51B5',
2019-06-25 22:20:24 +02:00
footerPaddingBottom: 0,
// FooterTab
2020-01-28 20:07:21 +01:00
tabBarTextColor: '#bfc6ea',
2019-06-25 22:20:24 +02:00
tabBarTextSize: 11,
2020-01-28 20:07:21 +01:00
activeTab: '#fff',
sTabBarActiveTextColor: '#007aff',
tabBarActiveTextColor: '#fff',
tabActiveBgColor: '#3F51B5',
2019-06-25 22:20:24 +02:00
// Header
2020-01-28 20:07:21 +01:00
toolbarBtnColor: '#fff',
toolbarDefaultBg: '#3F51B5',
2019-06-25 22:20:24 +02:00
toolbarHeight: 56,
toolbarSearchIconSize: 23,
2020-01-28 20:07:21 +01:00
toolbarInputColor: '#fff',
searchBarHeight: platform === PLATFORM.IOS ? 30 : 40,
searchBarInputHeight: platform === PLATFORM.IOS ? 40 : 50,
toolbarBtnTextColor: '#fff',
toolbarDefaultBorder: '#3F51B5',
iosStatusbar: 'light-content',
2019-06-25 22:20:24 +02:00
get statusBarColor() {
return color(this.toolbarDefaultBg)
.darken(0.2)
.hex();
},
get darkenHeader() {
return color(this.tabBgColor)
.darken(0.03)
.hex();
},
// Icon
2020-01-28 20:07:21 +01:00
iconFamily: 'Ionicons',
2019-06-25 22:20:24 +02:00
iconFontSize: 28,
iconHeaderSize: 24,
// InputGroup
inputFontSize: 17,
2020-01-28 20:07:21 +01:00
inputBorderColor: '#D9D5DC',
inputSuccessBorderColor: '#2b8339',
inputErrorBorderColor: '#ed2f2f',
2019-06-25 22:20:24 +02:00
inputHeightBase: 50,
get inputColor() {
return this.textColor;
},
get inputColorPlaceholder() {
2020-01-28 20:07:21 +01:00
return '#575757';
2019-06-25 22:20:24 +02:00
},
// Line Height
2020-01-28 20:07:21 +01:00
buttonLineHeight: 19,
2019-06-25 22:20:24 +02:00
lineHeightH1: 32,
lineHeightH2: 27,
lineHeightH3: 22,
lineHeight: 24,
// List
2020-01-28 20:07:21 +01:00
listBg: 'transparent',
listBorderColor: '#c9c9c9',
listDividerBg: '#f4f4f4',
listBtnUnderlayColor: '#DDD',
2019-06-25 22:20:24 +02:00
listItemPadding: 12,
2020-01-28 20:07:21 +01:00
listNoteColor: '#808080',
2019-06-25 22:20:24 +02:00
listNoteSize: 13,
2020-01-28 20:07:21 +01:00
listItemSelected: '#3F51B5',
2019-06-25 22:20:24 +02:00
// Progress Bar
2020-01-28 20:07:21 +01:00
defaultProgressColor: '#E4202D',
inverseProgressColor: '#1A191B',
2019-06-25 22:20:24 +02:00
// Radio Button
radioBtnSize: 23,
2020-01-28 20:07:21 +01:00
radioSelectedColorAndroid: '#3F51B5',
2019-06-25 22:20:24 +02:00
radioBtnLineHeight: 24,
get radioColor() {
return this.brandPrimary;
},
// Segment
2020-01-28 20:07:21 +01:00
segmentBackgroundColor: '#3F51B5',
segmentActiveBackgroundColor: '#fff',
segmentTextColor: '#fff',
segmentActiveTextColor: '#3F51B5',
segmentBorderColor: '#fff',
segmentBorderColorMain: '#3F51B5',
2019-06-25 22:20:24 +02:00
// Spinner
2020-01-28 20:07:21 +01:00
defaultSpinnerColor: '#45D56E',
inverseSpinnerColor: '#1A191B',
2019-06-25 22:20:24 +02:00
// Tab
2020-01-28 20:07:21 +01:00
tabDefaultBg: '#3F51B5',
topTabBarTextColor: '#b3c7f9',
topTabBarActiveTextColor: '#fff',
topTabBarBorderColor: '#fff',
topTabBarActiveBorderColor: '#fff',
2019-06-25 22:20:24 +02:00
// Tabs
2020-01-28 20:07:21 +01:00
tabBgColor: '#F8F8F8',
2019-06-25 22:20:24 +02:00
tabFontSize: 15,
// Text
2020-01-28 20:07:21 +01:00
textColor: '#000',
inverseTextColor: '#fff',
2019-06-25 22:20:24 +02:00
noteFontSize: 14,
get defaultTextColor() {
return this.textColor;
},
// Title
2020-01-28 20:07:21 +01:00
titleFontfamily: 'Roboto',
2019-06-25 22:20:24 +02:00
titleFontSize: 19,
subTitleFontSize: 14,
2020-01-28 20:07:21 +01:00
subtitleColor: '#FFF',
titleFontColor: '#FFF',
2019-06-25 22:20:24 +02:00
// Other
borderRadiusBase: 2,
borderWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
contentPadding: 10,
2020-01-28 20:07:21 +01:00
dropdownLinkColor: '#414142',
2019-06-25 22:20:24 +02:00
inputLineHeight: 24,
deviceWidth,
deviceHeight,
isIphoneX,
inputGroupRoundedBorderRadius: 30,
2020-01-28 20:07:21 +01:00
// iPhoneX SafeArea
2019-06-25 22:20:24 +02:00
Inset: {
portrait: {
topInset: 24,
leftInset: 0,
rightInset: 0,
bottomInset: 34
},
landscape: {
topInset: 0,
leftInset: 44,
rightInset: 44,
bottomInset: 21
}
}
};