mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 07:34:36 +01:00
working theming
This commit is contained in:
@@ -18,9 +18,10 @@ import Game from './components/menu/Game'
|
||||
import RightBar from './components/RightBar'
|
||||
import { getConfigOption, setConfigOption } from '../utils/configuration'
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
import { dataDir } from '@tauri-apps/api/path'
|
||||
import { appDir, dataDir } from '@tauri-apps/api/path'
|
||||
import { appWindow } from '@tauri-apps/api/window'
|
||||
import { convertFileSrc } from '@tauri-apps/api/tauri'
|
||||
import { getTheme, loadTheme } from '../utils/themes'
|
||||
|
||||
interface IProps {
|
||||
[key: string]: never;
|
||||
@@ -82,6 +83,13 @@ class App extends React.Component<IProps, IState> {
|
||||
const game_path = game_exe.substring(0, game_exe.replace(/\\/g, '/').lastIndexOf('/'))
|
||||
const root_path = game_path.substring(0, game_path.replace(/\\/g, '/').lastIndexOf('/'))
|
||||
|
||||
// Load a theme if it exists
|
||||
const theme = await getConfigOption('theme')
|
||||
if (theme) {
|
||||
const themeObj = await getTheme(theme)
|
||||
loadTheme(themeObj, document)
|
||||
}
|
||||
|
||||
if(!custom_bg || !/png|jpg|jpeg$/.test(custom_bg)) {
|
||||
if(game_path) {
|
||||
// Get the bg by invoking, then set the background to that bg.
|
||||
|
||||
Reference in New Issue
Block a user