diff --git a/.changeset/use-css-variable.md b/.changeset/use-css-variable.md new file mode 100644 index 00000000000..4987454b725 --- /dev/null +++ b/.changeset/use-css-variable.md @@ -0,0 +1,4 @@ +--- +"@primer/react": minor +--- +Use a CSS variable for the monospace font stack diff --git a/src/BranchName/__tests__/__snapshots__/BranchName.test.tsx.snap b/src/BranchName/__tests__/__snapshots__/BranchName.test.tsx.snap index 67046d28a4e..ca0731c2120 100644 --- a/src/BranchName/__tests__/__snapshots__/BranchName.test.tsx.snap +++ b/src/BranchName/__tests__/__snapshots__/BranchName.test.tsx.snap @@ -5,7 +5,7 @@ exports[`BranchName renders consistently 1`] = ` display: inline-block; padding: 2px 6px; font-size: 12px; - font-family: SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace; + font-family: var(--fontStack-monospace),SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace; color: #0969da; background-color: #ddf4ff; border-radius: 6px; diff --git a/src/__tests__/__snapshots__/TextInput.test.tsx.snap b/src/__tests__/__snapshots__/TextInput.test.tsx.snap index 63eaeab5e13..396cf25d24c 100644 --- a/src/__tests__/__snapshots__/TextInput.test.tsx.snap +++ b/src/__tests__/__snapshots__/TextInput.test.tsx.snap @@ -1343,7 +1343,7 @@ exports[`TextInput renders monospace 1`] = ` align-items: stretch; min-height: 32px; overflow: hidden; - font-family: SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace; + font-family: var(--fontStack-monospace),SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace; } .c0 input, diff --git a/src/theme.ts b/src/theme.ts index 884185e37b1..943c414ff4d 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -22,7 +22,15 @@ const fonts = { 'Apple Color Emoji', 'Segoe UI Emoji', ]), - mono: fontStack(['SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier', 'monospace']), + mono: fontStack([ + 'var(--fontStack-monospace)', + 'SFMono-Regular', + 'Consolas', + 'Liberation Mono', + 'Menlo', + 'Courier', + 'monospace', + ]), } const fontWeights = {