ssb: Add a manual theme color picker.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 18m1s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 18m1s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {LitElement, html, css, guard, until} from './lit-all.min.js';
|
||||
import * as tfrpc from '/static/tfrpc.js';
|
||||
import {styles} from './tf-styles.js';
|
||||
import {styles, generate_theme} from './tf-styles.js';
|
||||
|
||||
class TfElement extends LitElement {
|
||||
static get properties() {
|
||||
@@ -763,6 +763,17 @@ class TfElement extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
async pick_color() {
|
||||
let input = document.createElement('input');
|
||||
input.type = 'color';
|
||||
input.value = (await tfrpc.rpc.localStorageGet('color')) ?? '#ff0000';
|
||||
input.addEventListener('change', async function () {
|
||||
await tfrpc.rpc.localStorageSet('color', input.value);
|
||||
window.location.reload();
|
||||
});
|
||||
input.click();
|
||||
}
|
||||
|
||||
render() {
|
||||
let self = this;
|
||||
|
||||
@@ -819,6 +830,12 @@ class TfElement extends LitElement {
|
||||
</button>
|
||||
`
|
||||
)}
|
||||
<button
|
||||
class="w3-bar-item w3-button w3-right"
|
||||
@click=${this.pick_color}
|
||||
>
|
||||
🎨<span class="w3-hide-small">Color</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
let contents = this.guest
|
||||
@@ -854,6 +871,9 @@ class TfElement extends LitElement {
|
||||
`
|
||||
: undefined;
|
||||
return html`
|
||||
<style>
|
||||
${generate_theme()}
|
||||
</style>
|
||||
<div
|
||||
style="width: 100vw; min-height: 100vh; height: 100vh; display: flex; flex-direction: column"
|
||||
class="w3-theme-dark"
|
||||
|
||||
Reference in New Issue
Block a user