File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -639,7 +639,7 @@ const baselineUnit = 'rem';
639639/**
640640 * Converts a pixel value to a dynamic unit (defaulting to rem).
641641 *
642- * Examples:
642+ * Examples based on a root font size of 16px :
643643 * - `dynamicFont(16)` returns `'1rem'`
644644 * - `dynamicFont(20, 'em')` returns `'1.25em'`
645645 *
@@ -648,8 +648,8 @@ const baselineUnit = 'rem';
648648 * @param unit - The CSS unit string.
649649 * @returns The calculated CSS value string.
650650 */
651- export const dynamicFont = ( size : number , unit : string = baselineUnit ) : string => {
652- const baselinePixelSize = 16 ;
651+ export const dynamicFont = ( size : number , unit : string | undefined = baselineUnit ) : string => {
652+ const baselinePixelSize = parseFloat ( ( window as any ) . Ionic ?. config ?. get ?. ( 'theme' ) ?. fontSizes ?. root ?? 16 ) ;
653653
654654 return `${ size / baselinePixelSize } ${ unit } ` ;
655655} ;
You can’t perform that action at this time.
0 commit comments