mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
In preparation for merging radicle-desktop into radicle-gui. It's a pure rename, so git can follow every file across the move.
36 lines
794 B
TypeScript
36 lines
794 B
TypeScript
export const fontSettings = $state({ size: loadFontSize() });
|
|
const step = 2;
|
|
const minFontSize = 14;
|
|
const maxFontSize = 24;
|
|
|
|
export function increaseFontSize() {
|
|
if (fontSettings.size + step <= maxFontSize) {
|
|
setFontSize(fontSettings.size + step);
|
|
}
|
|
}
|
|
|
|
export function decreaseFontSize() {
|
|
if (fontSettings.size - step >= minFontSize) {
|
|
setFontSize(fontSettings.size - step);
|
|
}
|
|
}
|
|
|
|
export function resetFontSize() {
|
|
setFontSize(16);
|
|
}
|
|
|
|
function loadFontSize(): number {
|
|
const storedFontSize = localStorage ? localStorage.getItem("fontSize") : "16";
|
|
|
|
if (storedFontSize === null) {
|
|
return 16;
|
|
} else {
|
|
return parseInt(storedFontSize);
|
|
}
|
|
}
|
|
|
|
function setFontSize(size: number) {
|
|
fontSettings.size = size;
|
|
localStorage.setItem("fontSize", size.toString());
|
|
}
|