mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-01-01 22:47:19 +03:00
Several changes
- added theme switching - added dark theme support for the splash window
This commit is contained in:
parent
faee9c4a35
commit
e762825d91
7 changed files with 31 additions and 11 deletions
|
@ -167,10 +167,10 @@ This is our current roadmap goals. You can find older ones [here](ROADMAP.md)
|
||||||
* <s>Tooltips for some options</s>
|
* <s>Tooltips for some options</s>
|
||||||
* <s>Debugger</s>
|
* <s>Debugger</s>
|
||||||
* <s>Splash screen</s>
|
* <s>Splash screen</s>
|
||||||
|
* <s>Theming system</s>
|
||||||
* Game pre-installation
|
* Game pre-installation
|
||||||
* Launcher auto-updates
|
* Launcher auto-updates
|
||||||
* Statistics window
|
* Statistics window
|
||||||
* Theming system
|
|
||||||
* Chengelog window
|
* Chengelog window
|
||||||
* Default runner auto-installation
|
* Default runner auto-installation
|
||||||
* Ability to change the temp directory where the launcher should download some files
|
* Ability to change the temp directory where the launcher should download some files
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"fullScreen": false,
|
"fullScreen": false,
|
||||||
"alwaysOnTop": false,
|
"alwaysOnTop": false,
|
||||||
"icon": "/public/icons/64x64.png",
|
"icon": "/public/icons/64x64.png",
|
||||||
"enableInspector": true,
|
"enableInspector": false,
|
||||||
"borderless": false,
|
"borderless": false,
|
||||||
"maximize": false,
|
"maximize": false,
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
|
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
BIN
src/assets/gifs/running-qiqi.gif
Normal file
BIN
src/assets/gifs/running-qiqi.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 645 KiB |
|
@ -4,16 +4,20 @@
|
||||||
|
|
||||||
@mixin themable($theme-name, $theme-map)
|
@mixin themable($theme-name, $theme-map)
|
||||||
body[data-theme=#{$theme-name}]
|
body[data-theme=#{$theme-name}]
|
||||||
|
background-color: map.get($theme-map, "background")
|
||||||
|
|
||||||
div
|
div
|
||||||
width: 60%
|
width: 60%
|
||||||
margin: 56px auto 0 auto
|
margin: 56px auto 0 auto
|
||||||
|
|
||||||
video
|
img
|
||||||
width: 100%
|
width: 100%
|
||||||
|
image-rendering: optimizeQuality
|
||||||
|
|
||||||
h2, p
|
h2, p
|
||||||
margin: 0
|
margin: 0
|
||||||
text-align: center
|
text-align: center
|
||||||
|
color: map.get($theme-map, "text")
|
||||||
|
|
||||||
p
|
p
|
||||||
color: grey
|
color: grey
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { _, locale, locales } from 'svelte-i18n';
|
import { _, locale, locales } from 'svelte-i18n';
|
||||||
|
|
||||||
|
import Configs from './ts/Configs';
|
||||||
|
|
||||||
import Checkbox from './components/Checkbox.svelte';
|
import Checkbox from './components/Checkbox.svelte';
|
||||||
import SelectionBox from './components/SelectionBox.svelte';
|
import SelectionBox from './components/SelectionBox.svelte';
|
||||||
import DXVKSelectionList from './components/DXVKSelectionList.svelte';
|
import DXVKSelectionList from './components/DXVKSelectionList.svelte';
|
||||||
|
@ -92,13 +94,18 @@
|
||||||
selectedItem = visibleElement.getAttribute('id');
|
selectedItem = visibleElement.getAttribute('id');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const switchTheme = (theme: string) => {
|
||||||
|
if (theme === 'system')
|
||||||
|
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||||
|
|
||||||
|
document.body.setAttribute('data-theme', theme as string);
|
||||||
|
};
|
||||||
|
|
||||||
let dxvkRecommendable = true,
|
let dxvkRecommendable = true,
|
||||||
runnersRecommendable = true;
|
runnersRecommendable = true;
|
||||||
|
|
||||||
// Auto theme switcher
|
// Auto theme switcher
|
||||||
// TODO: an option to disable it
|
Configs.get('theme').then((theme) => switchTheme(theme as string));
|
||||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
||||||
document.body.setAttribute('data-theme', 'dark');
|
|
||||||
|
|
||||||
// Do some stuff when all the content will be loaded
|
// Do some stuff when all the content will be loaded
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -136,6 +143,7 @@
|
||||||
lang="settings.general.items.theme.title"
|
lang="settings.general.items.theme.title"
|
||||||
prop="theme"
|
prop="theme"
|
||||||
items={themes}
|
items={themes}
|
||||||
|
valueChanged={switchTheme}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Checkbox lang="settings.general.items.discord" prop="discord.enabled" />
|
<Checkbox lang="settings.general.items.discord" prop="discord.enabled" />
|
||||||
|
|
|
@ -2,9 +2,14 @@
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { _, locale } from 'svelte-i18n';
|
import { _, locale } from 'svelte-i18n';
|
||||||
|
|
||||||
|
import Configs from './ts/Configs';
|
||||||
|
|
||||||
import Window from './ts/neutralino/Window';
|
import Window from './ts/neutralino/Window';
|
||||||
|
|
||||||
import Splash from './assets/webms/loading.webm';
|
import Splash from './assets/gifs/running-qiqi.gif';
|
||||||
|
import SplashSecret from './assets/gifs/loading-marie-please.gif';
|
||||||
|
|
||||||
|
const splash = Math.round(Math.random() * 100) < 100 ? Splash : SplashSecret;
|
||||||
|
|
||||||
let phrase = Math.round(Math.random() * 2);
|
let phrase = Math.round(Math.random() * 2);
|
||||||
|
|
||||||
|
@ -37,14 +42,17 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Auto theme switcher
|
// Auto theme switcher
|
||||||
// TODO: an option to disable it
|
Configs.get('theme').then((theme) => {
|
||||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches)
|
if (theme === 'system')
|
||||||
document.body.setAttribute('data-theme', 'dark');
|
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||||
|
|
||||||
|
document.body.setAttribute('data-theme', theme as string);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if typeof $locale === 'string'}
|
{#if typeof $locale === 'string'}
|
||||||
<main>
|
<main>
|
||||||
<video src={Splash} loop muted autoplay></video>
|
<img src={splash} alt="" />
|
||||||
|
|
||||||
<h2>{$_('splash.title')}</h2>
|
<h2>{$_('splash.title')}</h2>
|
||||||
<p>{$_(`splash.phrases.${phrase}`)}</p>
|
<p>{$_(`splash.phrases.${phrase}`)}</p>
|
||||||
|
|
Loading…
Reference in a new issue