Added feature where if no user and device dark mode enabled, enable dark mode
• Added: - feature where if no user and device dark mode enabled, enable dark mode
This commit is contained in:
parent
25118d260e
commit
05e97f741e
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
|
import { me } from '../initial_state'
|
||||||
import {
|
import {
|
||||||
FONT_SIZES,
|
FONT_SIZES,
|
||||||
THEMES,
|
THEMES,
|
||||||
|
@ -22,6 +23,11 @@ class Display extends React.PureComponent {
|
||||||
this.updateRadiusSmallDisabled(this.state.radiusSmallDisabled)
|
this.updateRadiusSmallDisabled(this.state.radiusSmallDisabled)
|
||||||
this.updateRadiusCircleDisabled(this.state.radiusCircleDisabled)
|
this.updateRadiusCircleDisabled(this.state.radiusCircleDisabled)
|
||||||
this.updateFontSizes(this.state.fontSize)
|
this.updateFontSizes(this.state.fontSize)
|
||||||
|
|
||||||
|
// If no user logged in and dark mode enabled, set to muted
|
||||||
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && !me) {
|
||||||
|
this.updateTheme('muted')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(nextProps, prevState) {
|
static getDerivedStateFromProps(nextProps, prevState) {
|
||||||
|
|
Loading…
Reference in New Issue