mirror of https://github.com/vector-im/riot-web
tint when theming correctly
parent
8587b36715
commit
68115f5b9c
|
@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import UserSettingsStore from './UserSettingsStore';
|
||||
|
||||
// FIXME: these vars should be bundled up and attached to
|
||||
// module.exports otherwise this will break when included by both
|
||||
// react-sdk and apps layered on top.
|
||||
|
@ -122,6 +120,10 @@ module.exports = {
|
|||
return keyRgb;
|
||||
},
|
||||
|
||||
getCurrentColors: function() {
|
||||
return colors;
|
||||
},
|
||||
|
||||
tint: function(primaryColor, secondaryColor, tertiaryColor) {
|
||||
if (!cached) {
|
||||
this.calcCssFixups();
|
||||
|
@ -129,7 +131,6 @@ module.exports = {
|
|||
}
|
||||
|
||||
if (!primaryColor) {
|
||||
const theme = UserSettingsStore.getTheme();
|
||||
primaryColor = keyRgb[0];
|
||||
secondaryColor = keyRgb[1];
|
||||
}
|
||||
|
@ -191,6 +192,8 @@ module.exports = {
|
|||
calcCssFixups: function() {
|
||||
if (DEBUG) console.log("calcCssFixups start");
|
||||
|
||||
cssFixups.length = 0;
|
||||
|
||||
// update keyRgb from the current theme CSS itself, if it defines it
|
||||
if (document.getElementById('mx_theme_accentColor')) {
|
||||
keyRgb[0] = window.getComputedStyle(
|
||||
|
|
|
@ -920,6 +920,8 @@ module.exports = React.createClass({
|
|||
styleElements[theme].disabled = false;
|
||||
|
||||
Tinter.calcCssFixups();
|
||||
const colors = Tinter.getCurrentColors();
|
||||
Tinter.tint(colors[0], colors[1]);
|
||||
|
||||
if (theme === 'dark') {
|
||||
// abuse the tinter to change all the SVG's #fff to #2d2d2d
|
||||
|
|
Loading…
Reference in New Issue