joplin/ReactNativeClient/lib/components/global-style.js

73 lines
2.0 KiB
JavaScript
Raw Normal View History

2017-12-14 18:12:14 +00:00
const Setting = require('lib/models/Setting.js');
2017-08-01 17:59:01 +00:00
2017-07-21 21:40:02 +00:00
const globalStyle = {
2017-07-30 21:04:26 +00:00
fontSize: 16,
2017-07-21 21:40:02 +00:00
margin: 15, // No text and no interactive component should be within this margin
2017-07-30 21:04:26 +00:00
itemMarginTop: 10,
itemMarginBottom: 10,
2017-07-21 21:40:02 +00:00
backgroundColor: "#ffffff",
2017-07-22 15:55:09 +00:00
color: "#555555", // For regular text
2017-08-01 17:59:01 +00:00
colorError: "red",
colorWarn: "#9A5B00",
2017-07-22 15:55:09 +00:00
colorFaded: "#777777", // For less important text
2017-07-30 21:04:26 +00:00
fontSizeSmaller: 14,
2017-07-21 21:40:02 +00:00
dividerColor: "#dddddd",
2017-07-25 18:36:52 +00:00
selectedColor: '#e5e5e5',
2017-07-22 16:36:55 +00:00
disabledOpacity: 0.3,
2017-07-21 21:40:02 +00:00
2017-07-27 17:34:43 +00:00
raisedBackgroundColor: "#0080EF",
raisedColor: "#003363",
raisedHighlightedColor: "#ffffff",
2017-07-21 21:40:02 +00:00
// For WebView - must correspond to the properties above
2017-11-08 17:51:55 +00:00
htmlFontSize: '16px',
2017-08-01 18:53:50 +00:00
htmlColor: 'black', // Note: CSS in WebView component only supports named colors or rgb() notation
htmlBackgroundColor: 'white',
2017-07-22 17:21:39 +00:00
htmlDividerColor: 'Gainsboro',
2017-08-01 18:53:50 +00:00
htmlLinkColor: 'blue',
2017-11-08 17:51:55 +00:00
htmlLineHeight: '20px',
2017-07-21 21:40:02 +00:00
};
globalStyle.marginRight = globalStyle.margin;
globalStyle.marginLeft = globalStyle.margin;
2017-07-22 15:55:09 +00:00
globalStyle.marginTop = globalStyle.margin;
globalStyle.marginBottom = globalStyle.margin;
2017-07-21 21:40:02 +00:00
globalStyle.htmlMarginLeft = ((globalStyle.marginLeft / 10) * 0.6).toFixed(2) + 'em';
2017-07-22 16:36:55 +00:00
globalStyle.icon = {
color: globalStyle.color,
fontSize: 30,
};
2017-07-22 22:52:24 +00:00
globalStyle.lineInput = {
color: globalStyle.color,
backgroundColor: globalStyle.backgroundColor,
};
2017-08-01 17:59:01 +00:00
let themeCache_ = {};
function themeStyle(theme) {
if (themeCache_[theme]) return themeCache_[theme];
let output = Object.assign({}, globalStyle);
if (theme == Setting.THEME_LIGHT) return output;
output.backgroundColor = '#1D2024';
2017-08-01 18:53:50 +00:00
output.color = '#dddddd';
2017-08-01 17:59:01 +00:00
output.colorFaded = '#777777';
output.dividerColor = '#555555';
output.selectedColor = '#333333';
output.raisedBackgroundColor = "#0F2051";
2017-08-01 18:29:01 +00:00
output.raisedColor = "#788BC3";
2017-08-01 17:59:01 +00:00
output.raisedHighlightedColor = "#ffffff";
2017-08-01 18:53:50 +00:00
output.htmlColor = 'rgb(220,220,220)';
output.htmlBackgroundColor = 'rgb(29,32,36)';
output.htmlLinkColor = 'rgb(166,166,255)';
2017-08-01 17:59:01 +00:00
themeCache_[theme] = output;
return themeCache_[theme];
}
2017-11-03 00:13:17 +00:00
module.exports = { globalStyle, themeStyle };