🌒 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:
Eduardo Cruz Guedes 2025-09-03 03:56:36 -03:00 committed by GitHub
parent b66bf93b31
commit 122ff416ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 15 deletions

View file

@ -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,