Skip to content

Commit e337a39

Browse files
authored
fix(orchestrator):fix isDarkMode to work in auto mode (#940)
Signed-off-by: Lior Soffer <liorsoffer1@gmail.com>
1 parent 3267f77 commit e337a39

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
3+
---
4+
5+
fix isDarkMode to work in auto mode

workspaces/orchestrator/plugins/orchestrator/src/utils/isDarkMode.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { useObservable } from 'react-use';
16+
import { useTheme } from '@mui/material/styles';
1717

18-
import { appThemeApiRef, useApi } from '@backstage/core-plugin-api';
18+
export const useIsDarkMode = (): boolean => {
19+
const theme = useTheme();
1920

20-
export const useIsDarkMode = () => {
21-
const appThemeApi = useApi(appThemeApiRef);
22-
const activeThemeId = useObservable(
23-
appThemeApi.activeThemeId$(),
24-
appThemeApi.getActiveThemeId(),
25-
);
26-
27-
return activeThemeId === 'dark';
21+
return theme.palette.mode === 'dark';
2822
};

0 commit comments

Comments
 (0)