@@ -38,6 +38,7 @@ export interface Settings {
3838 }
3939 appearance : {
4040 fontSize : number
41+ lineHeight : number
4142 mono : string
4243 sans : string
4344 terminal : string
@@ -123,6 +124,7 @@ const defaultSettings: Settings = {
123124 } ,
124125 appearance : {
125126 fontSize : 14 ,
127+ lineHeight : 1.6 ,
126128 mono : "" ,
127129 sans : "" ,
128130 terminal : "" ,
@@ -158,8 +160,22 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
158160 createEffect ( ( ) => {
159161 if ( typeof document === "undefined" ) return
160162 const root = document . documentElement
163+ const fontSize = store . appearance ?. fontSize ?? defaultSettings . appearance . fontSize
164+ const lineHeight = store . appearance ?. lineHeight ?? defaultSettings . appearance . lineHeight
161165 root . style . setProperty ( "--font-family-mono" , monoFontFamily ( store . appearance ?. mono ) )
162166 root . style . setProperty ( "--font-family-sans" , sansFontFamily ( store . appearance ?. sans ) )
167+ root . style . setProperty ( "--font-size-base" , `${ fontSize } px` )
168+ root . style . setProperty ( "--font-size-x-small" , `calc(${ fontSize } px * 0.85)` )
169+ root . style . setProperty ( "--font-size-small" , `calc(${ fontSize } px * 0.9)` )
170+ root . style . setProperty ( "--font-size-large" , `calc(${ fontSize } px * 1.2)` )
171+ root . style . setProperty ( "--font-size-x-large" , `calc(${ fontSize } px * 1.4)` )
172+ root . style . setProperty ( "--font-size-mono" , `${ fontSize } px` )
173+ root . style . setProperty ( "--line-height-normal" , `${ lineHeight * 0.8125 } ` )
174+ root . style . setProperty ( "--line-height-large" , `${ lineHeight * 0.9375 } ` )
175+ root . style . setProperty ( "--line-height-x-large" , `${ lineHeight * 1.125 } ` )
176+ root . style . setProperty ( "--line-height-2x-large" , `${ lineHeight * 1.25 } ` )
177+ root . style . setProperty ( "--line-height-mono" , `${ lineHeight } ` )
178+ root . style . setProperty ( "--line-height-mono-px" , `${ fontSize * lineHeight } px` )
163179 } )
164180
165181 createEffect ( ( ) => {
@@ -248,6 +264,10 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
248264 setFontSize ( value : number ) {
249265 setStore ( "appearance" , "fontSize" , value )
250266 } ,
267+ lineHeight : withFallback ( ( ) => store . appearance ?. lineHeight , defaultSettings . appearance . lineHeight ) ,
268+ setLineHeight ( value : number ) {
269+ setStore ( "appearance" , "lineHeight" , value )
270+ } ,
251271 font : withFallback ( ( ) => store . appearance ?. mono , defaultSettings . appearance . mono ) ,
252272 setFont ( value : string ) {
253273 setStore ( "appearance" , "mono" , value . trim ( ) ? value : "" )
0 commit comments