mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 11:18:28 +00:00
add settings toggle for this feature
This commit is contained in:
parent
e43c9f653b
commit
694aecf624
@ -17,6 +17,10 @@
|
|||||||
"theme.dark": "dark",
|
"theme.dark": "dark",
|
||||||
"theme.description": "auto theme switches between light and dark themes depending on your device's display mode.",
|
"theme.description": "auto theme switches between light and dark themes depending on your device's display mode.",
|
||||||
|
|
||||||
|
"sidebar": "sidebar",
|
||||||
|
"sidebar.dark.title": "dark sidebar",
|
||||||
|
"sidebar.dark.description": "by default, the sidebar will be dark in light theme. if you'd prefer it to match the light theme, enable this option.",
|
||||||
|
|
||||||
"video.quality": "video quality",
|
"video.quality": "video quality",
|
||||||
"video.quality.max": "8k+",
|
"video.quality.max": "8k+",
|
||||||
"video.quality.2160": "4k",
|
"video.quality.2160": "4k",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { t } from "$lib/i18n/translations";
|
import { t } from "$lib/i18n/translations";
|
||||||
import { defaultNavPage } from "$lib/subnav";
|
import { defaultNavPage } from "$lib/subnav";
|
||||||
|
import settings from "$lib/state/settings";
|
||||||
|
|
||||||
import CobaltLogo from "$components/sidebar/CobaltLogo.svelte";
|
import CobaltLogo from "$components/sidebar/CobaltLogo.svelte";
|
||||||
import SidebarTab from "$components/sidebar/SidebarTab.svelte";
|
import SidebarTab from "$components/sidebar/SidebarTab.svelte";
|
||||||
@ -19,13 +20,17 @@
|
|||||||
let aboutLink = defaultNavPage("about");
|
let aboutLink = defaultNavPage("about");
|
||||||
|
|
||||||
$: screenWidth,
|
$: screenWidth,
|
||||||
settingsLink = defaultNavPage("settings"),
|
(settingsLink = defaultNavPage("settings")),
|
||||||
aboutLink = defaultNavPage("about");
|
(aboutLink = defaultNavPage("about"));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window bind:innerWidth={screenWidth} />
|
<svelte:window bind:innerWidth={screenWidth} />
|
||||||
|
|
||||||
<nav id="sidebar" aria-label={$t("a11y.tabs.tab_panel")}>
|
<nav
|
||||||
|
id="sidebar"
|
||||||
|
aria-label={$t("a11y.tabs.tab_panel")}
|
||||||
|
class:always-dark={$settings.appearance.darkSidebar}
|
||||||
|
>
|
||||||
<CobaltLogo />
|
<CobaltLogo />
|
||||||
<div id="sidebar-tabs" role="tablist">
|
<div id="sidebar-tabs" role="tablist">
|
||||||
<div id="sidebar-actions" class="sidebar-inner-container">
|
<div id="sidebar-actions" class="sidebar-inner-container">
|
||||||
@ -66,6 +71,7 @@
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: calc(var(--sidebar-width) + var(--sidebar-inner-padding) * 2);
|
width: calc(var(--sidebar-width) + var(--sidebar-inner-padding) * 2);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
color: var(--sidebar-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-tabs {
|
#sidebar-tabs {
|
||||||
|
@ -7,11 +7,12 @@ const defaultSettings: CobaltSettings = {
|
|||||||
debug: false,
|
debug: false,
|
||||||
},
|
},
|
||||||
appearance: {
|
appearance: {
|
||||||
theme: "auto",
|
|
||||||
language: defaultLocale,
|
|
||||||
autoLanguage: true,
|
autoLanguage: true,
|
||||||
|
darkSidebar: true,
|
||||||
|
language: defaultLocale,
|
||||||
reduceMotion: false,
|
reduceMotion: false,
|
||||||
reduceTransparency: false,
|
reduceTransparency: false,
|
||||||
|
theme: "auto",
|
||||||
},
|
},
|
||||||
save: {
|
save: {
|
||||||
audioBitrate: "128",
|
audioBitrate: "128",
|
||||||
|
@ -11,11 +11,12 @@ export const youtubeVideoCodecOptions = ["h264", "av1", "vp9"] as const;
|
|||||||
export const savingMethodOptions = ["ask", "download", "share", "copy"] as const;
|
export const savingMethodOptions = ["ask", "download", "share", "copy"] as const;
|
||||||
|
|
||||||
type CobaltSettingsAppearance = {
|
type CobaltSettingsAppearance = {
|
||||||
theme: typeof themeOptions[number],
|
|
||||||
language: keyof typeof languages,
|
|
||||||
autoLanguage: boolean,
|
autoLanguage: boolean,
|
||||||
|
darkSidebar: boolean,
|
||||||
|
language: keyof typeof languages,
|
||||||
reduceMotion: boolean,
|
reduceMotion: boolean,
|
||||||
reduceTransparency: boolean,
|
reduceTransparency: boolean,
|
||||||
|
theme: typeof themeOptions[number],
|
||||||
};
|
};
|
||||||
|
|
||||||
type CobaltSettingsAdvanced = {
|
type CobaltSettingsAdvanced = {
|
||||||
|
@ -46,11 +46,14 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<meta name="description" content={$t("general.embed.description")}>
|
<meta name="description" content={$t("general.embed.description")} />
|
||||||
<meta property="og:description" content={$t("general.embed.description")}>
|
<meta property="og:description" content={$t("general.embed.description")} />
|
||||||
|
|
||||||
{#if env.HOST}
|
{#if env.HOST}
|
||||||
<meta property="og:url" content="https://{env.HOST}{$page.url.pathname}">
|
<meta
|
||||||
|
property="og:url"
|
||||||
|
content="https://{env.HOST}{$page.url.pathname}"
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if device.is.mobile}
|
{#if device.is.mobile}
|
||||||
@ -67,7 +70,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div style="display: contents" data-theme={browser ? $currentTheme : undefined} lang={$locale}>
|
<div
|
||||||
|
style="display: contents"
|
||||||
|
data-theme={browser ? $currentTheme : undefined}
|
||||||
|
lang={$locale}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
id="cobalt"
|
id="cobalt"
|
||||||
class:loaded={browser}
|
class:loaded={browser}
|
||||||
@ -123,9 +130,9 @@
|
|||||||
--dialog-backdrop: rgba(255, 255, 255, 0.3);
|
--dialog-backdrop: rgba(255, 255, 255, 0.3);
|
||||||
|
|
||||||
--sidebar-bg: #f4f4f4;
|
--sidebar-bg: #f4f4f4;
|
||||||
--sidebar-text: var(--secondary);
|
--sidebar-text: #101010;
|
||||||
--sidebar-highlight: var(--secondary);
|
--sidebar-highlight: #101010;
|
||||||
--sidebar-highlight-text: var(--primary);
|
--sidebar-highlight-text: var(--sidebar-bg);
|
||||||
--sidebar-hover: rgba(0, 0, 0, 0.1);
|
--sidebar-hover: rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
--input-border: #adadb7;
|
--input-border: #adadb7;
|
||||||
@ -199,12 +206,6 @@
|
|||||||
|
|
||||||
--dialog-backdrop: rgba(0, 0, 0, 0.3);
|
--dialog-backdrop: rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
--sidebar-bg: #101010;
|
|
||||||
--sidebar-text: var(--secondary);
|
|
||||||
--sidebar-highlight: var(--secondary);
|
|
||||||
--sidebar-highlight-text: var(--sidebar-bg);
|
|
||||||
--sidebar-hover: rgba(255, 255, 255, 0.1);
|
|
||||||
|
|
||||||
--input-border: #383838;
|
--input-border: #383838;
|
||||||
|
|
||||||
--toggle-bg: var(--input-border);
|
--toggle-bg: var(--input-border);
|
||||||
@ -234,6 +235,15 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global([data-theme="dark"]),
|
||||||
|
:global(#sidebar.always-dark) {
|
||||||
|
--sidebar-bg: #101010;
|
||||||
|
--sidebar-text: #f4f4f4;
|
||||||
|
--sidebar-highlight: #f4f4f4;
|
||||||
|
--sidebar-highlight-text: var(--sidebar-bg);
|
||||||
|
--sidebar-hover: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
:global([data-theme="light"] [data-reduce-transparency="true"]) {
|
:global([data-theme="light"] [data-reduce-transparency="true"]) {
|
||||||
--dialog-backdrop: rgba(255, 255, 255, 0.6);
|
--dialog-backdrop: rgba(255, 255, 255, 0.6);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { t } from "$lib/i18n/translations";
|
import { t } from "$lib/i18n/translations";
|
||||||
|
|
||||||
|
import settings from "$lib/state/settings";
|
||||||
|
|
||||||
import { themeOptions } from "$lib/types/settings";
|
import { themeOptions } from "$lib/types/settings";
|
||||||
|
|
||||||
import Switcher from "$components/buttons/Switcher.svelte";
|
import Switcher from "$components/buttons/Switcher.svelte";
|
||||||
@ -24,6 +26,17 @@
|
|||||||
</Switcher>
|
</Switcher>
|
||||||
</SettingsCategory>
|
</SettingsCategory>
|
||||||
|
|
||||||
|
{#if $settings.appearance.theme === "light"}
|
||||||
|
<SettingsCategory sectionId="sidebar" title={$t("settings.sidebar")}>
|
||||||
|
<SettingsToggle
|
||||||
|
settingContext="appearance"
|
||||||
|
settingId="darkSidebar"
|
||||||
|
title={$t("settings.sidebar.dark.title")}
|
||||||
|
description={$t("settings.sidebar.dark.description")}
|
||||||
|
/>
|
||||||
|
</SettingsCategory>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<SettingsCategory sectionId="language" title={$t("settings.language")}>
|
<SettingsCategory sectionId="language" title={$t("settings.language")}>
|
||||||
<SettingsToggle
|
<SettingsToggle
|
||||||
settingContext="appearance"
|
settingContext="appearance"
|
||||||
|
Loading…
Reference in New Issue
Block a user