Fixed theme handling for new tag feature

pull/925/head^2
Laurent Cozic 2018-11-07 22:47:34 +00:00
parent ee106105d8
commit 11ddc55911
1 changed files with 28 additions and 19 deletions

View File

@ -21,7 +21,6 @@ const globalStyle = {
toolbarHeight: 35, toolbarHeight: 35,
tagItemPadding: 3, tagItemPadding: 3,
tagBackgroundColor: '#e5e5e5',
}; };
// For WebView - must correspond to the properties above // For WebView - must correspond to the properties above
@ -108,9 +107,8 @@ const lightStyle = {
selectedColor2: "#0269C2", selectedColor2: "#0269C2",
colorError2: "#ff6c6c", colorError2: "#ff6c6c",
raisedBackgroundColor: "#0080EF", raisedBackgroundColor: "#e5e5e5",
raisedColor: "#003363", raisedColor: "#222222",
raisedHighlightedColor: "#ffffff",
warningBackgroundColor: "#FFD08D", warningBackgroundColor: "#FFD08D",
@ -146,9 +144,8 @@ const darkStyle = {
selectedColor2: "#0269C2", selectedColor2: "#0269C2",
colorError2: "#ff6c6c", colorError2: "#ff6c6c",
raisedBackgroundColor: "#0F2051", raisedBackgroundColor: "#474747",
raisedColor: "#788BC3", raisedColor: "#ffffff",
raisedHighlightedColor: "#ffffff",
warningBackgroundColor: "#CC6600", warningBackgroundColor: "#CC6600",
@ -166,18 +163,23 @@ const darkStyle = {
codeThemeCss: "atom-one-dark-reasonable.css", codeThemeCss: "atom-one-dark-reasonable.css",
}; };
globalStyle.tagStyle = { function addExtraStyles(style) {
fontSize: globalStyle.fontSize, style.tagStyle = {
fontFamily: globalStyle.fontFamily, fontSize: style.fontSize,
marginTop: globalStyle.itemMarginTop * 0.4, fontFamily: style.fontFamily,
marginBottom: globalStyle.itemMarginBottom * 0.4, marginTop: style.itemMarginTop * 0.4,
marginRight: globalStyle.margin * 0.3, marginBottom: style.itemMarginBottom * 0.4,
paddingTop: globalStyle.tagItemPadding, marginRight: style.margin * 0.3,
paddingBottom: globalStyle.tagItemPadding, paddingTop: style.tagItemPadding,
paddingRight: globalStyle.tagItemPadding * 2, paddingBottom: style.tagItemPadding,
paddingLeft: globalStyle.tagItemPadding * 2, paddingRight: style.tagItemPadding * 2,
backgroundColor: globalStyle.tagBackgroundColor paddingLeft: style.tagItemPadding * 2,
}; backgroundColor: style.raisedBackgroundColor,
color: style.raisedColor,
};
return style;
}
let themeCache_ = {}; let themeCache_ = {};
@ -193,6 +195,11 @@ function themeStyle(theme) {
output = Object.assign({}, globalStyle, darkStyle); output = Object.assign({}, globalStyle, darkStyle);
} }
// TODO: All the theme specific things should go in addExtraStyles
// so that their definition is not split between here and the
// beginning of the file. At least new styles should go in
// addExtraStyles.
output.textStyle = Object.assign({}, output.textStyle = Object.assign({},
output.textStyle, output.textStyle,
{ color: output.color } { color: output.color }
@ -270,6 +277,8 @@ function themeStyle(theme) {
} }
); );
output = addExtraStyles(output);
themeCache_[theme] = output; themeCache_[theme] = output;
return themeCache_[theme]; return themeCache_[theme];
} }