@codecademy/gamut-styles

17.13.117.13.2-alpha.c910ea.0
dist/utilities/fontUtils.js
+dist/utilities/fontUtils.jsNew file
+27
Index: package/dist/utilities/fontUtils.js
===================================================================
--- package/dist/utilities/fontUtils.js
+++ package/dist/utilities/fontUtils.js
@@ -0,0 +1,27 @@
+import { webFonts } from '../remoteAssets/fonts';
+const isThemeName = name => {
+  return name in webFonts;
+};
+/**
+ * Retrieves font configurations based on the provided theme name.
+ *
+ * Returns the appropriate font configuration array for the given theme.
+ * If no theme name is provided or the theme name is not recognized,
+ * returns the core fonts as a fallback.
+ *
+ * @param themeName - The name of the theme to get fonts for, or undefined
+ * @returns A readonly array of FontConfig objects for the specified theme
+ *
+ * @example
+ * ```ts
+ * const fonts = getFonts('percipio'); // Returns percipio theme fonts
+ * const coreFonts = getFonts(undefined); // Returns core fonts
+ * const invalidFonts = getFonts('invalid'); // Returns core fonts as fallback
+ * ```
+ */
+export const getFonts = themeName => {
+  if (!themeName || !isThemeName(themeName)) {
+    return webFonts.core;
+  }
+  return webFonts[themeName];
+};
\ No newline at end of file