mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-06 17:51:50 +01:00
🌒 refactor: Theme Handling to use isDark Utility (#9405)
* ✨ fix: Refactor theme handling to use isDark utility across components * 🔧 fix: Update package client version to 0.2.8 and adjust theme import path in ThemeSelector component --------- Co-authored-by: Marco Beretta <81851188+berry-13@users.noreply.github.com>
This commit is contained in:
parent
b66bf93b31
commit
122ff416ac
6 changed files with 11 additions and 15 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { createContext, useRef, useContext, RefObject } from 'react';
|
||||
import { toCanvas } from 'html-to-image';
|
||||
import { ThemeContext } from '@librechat/client';
|
||||
import { ThemeContext, isDark } from '@librechat/client';
|
||||
|
||||
type ScreenshotContextType = {
|
||||
ref?: RefObject<HTMLDivElement>;
|
||||
|
|
@ -17,11 +17,7 @@ export const useScreenshot = () => {
|
|||
throw new Error('You should provide correct html node.');
|
||||
}
|
||||
|
||||
let isDark = theme === 'dark';
|
||||
if (theme === 'system') {
|
||||
isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
}
|
||||
const backgroundColor = isDark ? '#171717' : 'white';
|
||||
const backgroundColor = isDark(theme) ? '#171717' : 'white';
|
||||
|
||||
const canvas = await toCanvas(node, {
|
||||
backgroundColor,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue