diff --git a/src/app.css b/src/app.css index a2fcb7d2..39862a70 100644 --- a/src/app.css +++ b/src/app.css @@ -1065,7 +1065,7 @@ body:has(.status-deck) .media-post-link { .szh-menu { padding: 8px 0; margin: 0; - font-size: 16px; + font-size: var(--text-size); background-color: var(--bg-color); border: 1px solid var(--outline-color); border-radius: 8px; diff --git a/src/app.jsx b/src/app.jsx index 2091994d..a3d3d7f8 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -74,6 +74,13 @@ function App() { .querySelector('meta[name="color-scheme"]') .setAttribute('content', theme === 'auto' ? 'dark light' : theme); } + const textSize = store.local.get('textSize'); + if (textSize) { + document.documentElement.style.setProperty( + '--text-size', + `${textSize}px`, + ); + } }, []); useEffect(() => { diff --git a/src/index.css b/src/index.css index 796ec971..10f83f35 100644 --- a/src/index.css +++ b/src/index.css @@ -2,6 +2,7 @@ @custom-media --viewport-medium (min-width: 40em); :root { + --text-size: 16px; --main-width: 40em; text-size-adjust: none; --hairline-width: 1px; @@ -90,7 +91,7 @@ html { body { font-family: ui-rounded, system-ui; - font-size: 16px; + font-size: var(--text-size); word-wrap: break-word; overflow-wrap: break-word; } diff --git a/src/pages/settings.css b/src/pages/settings.css index c2b52f1f..2fdc12b4 100644 --- a/src/pages/settings.css +++ b/src/pages/settings.css @@ -105,3 +105,12 @@ #settings-container .radio-group label:has(input:checked) input:checked + span { color: inherit; } + +#settings-container .range-group { + display: flex; + align-items: center; + gap: 8px; +} +#settings-container .range-group input[type='range'] { + flex-grow: 1; +} diff --git a/src/pages/settings.jsx b/src/pages/settings.jsx index decb90e7..bd0d261a 100644 --- a/src/pages/settings.jsx +++ b/src/pages/settings.jsx @@ -11,6 +11,9 @@ import localeCode2Text from '../utils/localeCode2Text'; import states from '../utils/states'; import store from '../utils/store'; +const DEFAULT_TEXT_SIZE = 16; +const TEXT_SIZES = [16, 17, 18, 19, 20]; + function Settings({ onClose }) { const snapStates = useSnapshot(states); const currentTheme = store.local.get('theme') || 'auto'; @@ -19,6 +22,7 @@ function Settings({ onClose }) { snapStates.settings.contentTranslationTargetLanguage || null; const systemTargetLanguage = getTranslateTargetLanguage(); const systemTargetLanguageText = localeCode2Text(systemTargetLanguage); + const currentTextSize = store.local.get('textSize') || DEFAULT_TEXT_SIZE; return (