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