global theming works
This commit is contained in:
parent
d15158f79c
commit
7e5b9596a4
@ -12,9 +12,11 @@
|
|||||||
|
|
||||||
let width: int = 10
|
let width: int = 10
|
||||||
let navMargin = document.getElementById("body") as HTMLElement;
|
let navMargin = document.getElementById("body") as HTMLElement;
|
||||||
|
let r
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
CheckPrerequisites().then(() => $loading = false)
|
CheckPrerequisites().then(() => $loading = false)
|
||||||
|
r = document.getElementById('wrapper');
|
||||||
})
|
})
|
||||||
function setMargin(){
|
function setMargin(){
|
||||||
document.documentElement.style.setProperty('--navMargin', '17rem');
|
document.documentElement.style.setProperty('--navMargin', '17rem');
|
||||||
@ -23,10 +25,22 @@
|
|||||||
document.documentElement.style.setProperty('--navMargin', '5rem');
|
document.documentElement.style.setProperty('--navMargin', '5rem');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initialColor() {
|
||||||
|
r.style.setProperty('--accent-color', 'purple');
|
||||||
|
}
|
||||||
|
function setcolor() {
|
||||||
|
console.log("changing theme");
|
||||||
|
r.style.setProperty('--accent-color', 'green');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
window.document.onload = function() {initialColor()};
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
<div id = "wrapper">
|
||||||
<div class="navbar" on:mouseover={setMargin} on:focus={setMargin} on:mouseleave={unsetMargin} >
|
<div class="navbar" on:mouseover={setMargin} on:focus={setMargin} on:mouseleave={unsetMargin} >
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</div>
|
</div>
|
||||||
@ -38,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else if $currentPage == 1}
|
{:else if $currentPage == 1}
|
||||||
<div transition:slide="{{duration:100}}" class="central">
|
<div transition:slide="{{duration:100}}" class="central">
|
||||||
<Instancepage />
|
<Instancepage on:change-theme = {setcolor} />
|
||||||
</div>
|
</div>
|
||||||
{:else if $currentPage == 2}
|
{:else if $currentPage == 2}
|
||||||
<div transition:slide="{{duration:100}}" class="central">
|
<div transition:slide="{{duration:100}}" class="central">
|
||||||
@ -46,6 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</body>
|
</body>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -57,6 +72,10 @@
|
|||||||
--bg-primary: #141418;
|
--bg-primary: #141418;
|
||||||
--navMargin: 5rem;
|
--navMargin: 5rem;
|
||||||
background-color: var(--bg-secondary);
|
background-color: var(--bg-secondary);
|
||||||
|
|
||||||
|
}
|
||||||
|
#wrapper{
|
||||||
|
--accent-color: purple;
|
||||||
}
|
}
|
||||||
.navbar{
|
.navbar{
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import {instances, loading, navMargin} from './global'
|
import {instances, loading, navMargin} from './global'
|
||||||
import {InstallVanilla, LaunchInstance, GetInstances, InstallForge, InstallQuilt, InstallFabric, CheckUpdate} from '../wailsjs/go/main/InstanceManager.js'
|
import {InstallVanilla, LaunchInstance, GetInstances, InstallForge, InstallQuilt, InstallFabric, CheckUpdate} from '../wailsjs/go/main/InstanceManager.js'
|
||||||
import {GetVersions} from '../wailsjs/go/main/App.js'
|
import {GetVersions} from '../wailsjs/go/main/App.js'
|
||||||
import {onMount} from 'svelte'
|
import {onMount, createEventDispatcher} from 'svelte'
|
||||||
var testArray = ["test","test2","test3"];
|
var testArray = ["test","test2","test3"];
|
||||||
|
|
||||||
let pack: string = "";
|
let pack: string = "";
|
||||||
@ -10,14 +10,16 @@ import {onMount} from 'svelte'
|
|||||||
let radio: string = "";
|
let radio: string = "";
|
||||||
let marginScale: string= $navMargin + "rem";
|
let marginScale: string= $navMargin + "rem";
|
||||||
var r = document.querySelector('main');
|
var r = document.querySelector('main');
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
onMount(() => {
|
function changetheme(){
|
||||||
r.style.setProperty('--accent-color', 'purple');
|
dispatch('change-theme');
|
||||||
})
|
|
||||||
|
|
||||||
function setcolor(){
|
|
||||||
r.style.setProperty('--accent-color', 'green');
|
|
||||||
}
|
}
|
||||||
|
//function initialColor() {
|
||||||
|
// r.style.setProperty('--accent-color', 'purple');
|
||||||
|
//}
|
||||||
|
//window.document.onload = function() {initialColor()};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ import {onMount} from 'svelte'
|
|||||||
</div>
|
</div>
|
||||||
<div class="options-container">
|
<div class="options-container">
|
||||||
<button class="launch-button" on:click={launchclick}>Launch {radio}</button>
|
<button class="launch-button" on:click={launchclick}>Launch {radio}</button>
|
||||||
<button class="changecolor" on:click={setcolor}>Change color</button>
|
<button class="changecolor" on:click={changetheme}>Change color</button>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user