fix: fix bug with theme setting

This commit is contained in:
jinhojang6 2024-03-21 01:03:38 +09:00
parent 616e9ca06e
commit d8fac409d7
No known key found for this signature in database
GPG Key ID: 1762F21FE8B543F8
3 changed files with 26 additions and 6 deletions

View File

@ -74,29 +74,33 @@ main > div > div:first-child {
} }
.apply-form > label { .apply-form > label {
color: white; color: var(--green);
} }
.apply-form > p { .apply-form > p {
color: white; color: var(--green);
} }
.apply-input { .apply-input {
padding: 4px 12px; padding: 4px 12px;
background: transparent; background: transparent;
border: 1px solid white; border: 1px solid var(--green);
margin-bottom: 12px; margin-bottom: 12px;
} }
.apply-submit { .apply-submit {
padding: 4px 12px; padding: 4px 12px;
background: transparent; background: transparent;
color: white; color: var(--green);
border: 1px solid white; border: 1px solid var(--green);
margin-top: 12px; margin-top: 12px;
margin-bottom: 24px; margin-bottom: 24px;
} }
.theme-list {
white-space: pre-wrap !important;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.apply-form { .apply-form {
flex-direction: column; flex-direction: column;

View File

@ -13,6 +13,15 @@
onMount(() => { onMount(() => {
input.focus(); input.focus();
console.log("dsadas", $theme);
document.documentElement.style.setProperty(
"--text-color",
`${$theme.foreground}`
);
document.documentElement.style.setProperty("--green", `${$theme.green}`);
if ($history.length === 0) { if ($history.length === 0) {
const command = commands["banner"] as () => string; const command = commands["banner"] as () => string;

View File

@ -76,7 +76,7 @@ export const commands: Record<
let result = themes.map((t) => t.name.toLowerCase()).join(", "); let result = themes.map((t) => t.name.toLowerCase()).join(", ");
result += `You can preview all these themes here: ${packageJson.repository.url}/tree/master/docs/themes`; result += `You can preview all these themes here: ${packageJson.repository.url}/tree/master/docs/themes`;
return result; return `<template><span class="theme-list">${result}</span></template>`;
} }
case "set": { case "set": {
@ -91,6 +91,13 @@ export const commands: Record<
return `Theme '${selectedTheme}' not found. Try 'theme ls' to see all available themes.`; return `Theme '${selectedTheme}' not found. Try 'theme ls' to see all available themes.`;
} }
document.documentElement.style.setProperty(
"--text-color",
`${t.foreground}`
);
document.documentElement.style.setProperty("--green", `${t.green}`);
theme.set(t); theme.set(t);
return `Theme set to ${selectedTheme}`; return `Theme set to ${selectedTheme}`;