8000 feat: support multiple terminal fonts by mtojek · Pull Request #17257 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: support multiple terminal fonts #17257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
mtojek committed Apr 7, 2025
commit 59854a66eb24902ed673490b1340249498edfd86
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ import { PreviewBadge } from "components/Badges/Badges";
import { Stack } from "components/Stack/Stack";
import { ThemeOverride } from "contexts/ThemeProvider";
import type { FC } from "react";
import themes, {
DEFAULT_TERMINAL_FONT,
DEFAULT_THEME,
fontLabels,
type Theme,
} from "theme";
import themes, { DEFAULT_THEME, type Theme } from "theme";
import { DEFAULT_TERMINAL_FONT, terminalFontLabels } from "theme/constants";
import { Section } from "../Section";

export interface AppearanceFormProps {
Expand Down Expand Up @@ -119,8 +115,8 @@ export const AppearanceForm: FC<AppearanceFormProps> = ({
value={name}
control={<Radio />}
label={
<div css={{ fontFamily: fontLabels[name] }}>
{fontLabels[name]}
<div css={{ fontFamily: terminalFontLabels[name] }}>
{terminalFontLabels[name]}
</div>
}
/>
Expand Down
9 changes: 8 additions & 1 deletion site/src/theme/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import type { TerminalFontName } from "api/typesGenerated";
export const borderRadius = 8;
export const MONOSPACE_FONT_FAMILY =
"'IBM Plex Mono', 'Lucida Console', 'Lucida Sans Typewriter', 'Liberation Mono', 'Monaco', 'Courier New', Courier, monospace";
export const BODY_FONT_FAMILY = `"Inter Variable", system-ui, sans-serif`;

export const terminalFonts: Record<TerminalFontName, string> = {
"fira-code": MONOSPACE_FONT_FAMILY.replace("IBM Plex Mono", "Fira Code"),
"ibm-plex-mono": MONOSPACE_FONT_FAMILY,

"": MONOSPACE_FONT_FAMILY,
};
export const terminalFontLabels: Record<TerminalFontName, string> = {
"fira-code": "Fira Code",
"ibm-plex-mono": "IBM Plex Mono",
"": "", // needed for enum completeness, otherwise fails the build
};
export const DEFAULT_TERMINAL_FONT = "ibm-plex-mono";

export const BODY_FONT_FAMILY = `"Inter Variable", system-ui, sans-serif`;
export const navHeight = 62;
export const containerWidth = 1380;
export const containerWidthMedium = 1080;
Expand Down
10 changes: 0 additions & 10 deletions site/src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import type { Theme as MuiTheme } from "@mui/material/styles";
import type { TerminalFontName } from "api/typesGenerated";
import type * as monaco from "monaco-editor";
import { of } from "rxjs";
import type { Branding } from "./branding";
import { terminalFonts } from "./constants";
import dark from "./dark";
import type { NewTheme } from "./experimental";
import type { ExternalImageModeStyles } from "./externalImages";
Expand Down Expand Up @@ -39,11 +37,3 @@ const theme = {
} satisfies Record<string, Theme>;

export default theme;

export const fontLabels: Record<TerminalFontName, string> = {
"fira-code": "Fira Code",
"ibm-plex-mono": "IBM Plex Mono",
"": "", // needed for enum completeness, otherwise fails the build
};

export const DEFAULT_TERMINAL_FONT = "ibm-plex-mono";
0