Files
radicle-explorer/src/App/Header/ThemeSettings.svelte
T
Rūdolfs Ošiņš db2c744e45 Reduce blue color usage in menu buttons buttons
This makes the interface overall more legible.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-10-30 14:41:23 +01:00

90 lines
2.0 KiB
Svelte

<script lang="ts">
import type { CodeFont, Theme } from "@app/lib/appearance";
import {
codeFont,
codeFonts,
storeCodeFont,
storeTheme,
theme,
} from "@app/lib/appearance";
import Icon from "@app/components/Icon.svelte";
import Radio from "@app/components/Radio.svelte";
import Button from "@app/components/Button.svelte";
$: document.documentElement.setAttribute("data-codefont", $codeFont);
$: document.documentElement.setAttribute("data-theme", $theme);
function switchFont(font: CodeFont) {
codeFont.set(font);
storeCodeFont(font);
}
function switchTheme(newTheme: Theme) {
theme.set(newTheme);
storeTheme(newTheme);
}
</script>
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
gap: 1.5rem;
font-size: var(--font-size-small);
}
.item {
display: flex;
width: 100%;
align-items: center;
}
.right {
display: flex;
margin-left: auto;
}
</style>
<div class="container">
<div class="item">
<div>Theme</div>
<div class="right">
<Radio>
<Button
ariaLabel="Light Mode"
styleBorderRadius="0"
variant={$theme === "light" ? "gray-white" : "dim"}
on:click={() => switchTheme("light")}>
<Icon name="sun" />
</Button>
<Button
ariaLabel="Dark Mode"
styleBorderRadius="0"
variant={$theme === "dark" ? "gray-white" : "dim"}
on:click={() => switchTheme("dark")}>
<Icon name="moon" />
</Button>
</Radio>
</div>
</div>
<div class="item">
<div>Code Font</div>
<div class="right">
<Radio>
{#each codeFonts as font}
<Button
styleBorderRadius="0"
styleFontFamily={font.fontFamily}
on:click={() => switchFont(font.storedName)}
variant={$codeFont === font.storedName ? "gray-white" : "dim"}>
{font.displayName}
</Button>
{/each}
</Radio>
</div>
</div>
</div>