Studio: lighten chat text weight on Linux to match macOS rendering (#7308)

* Studio: lighten chat text weight on Linux to match macOS rendering

* Exclude custom interface fonts from the Linux chat weight compensation

* Simplify Linux chat font weight override
This commit is contained in:
oobabooga 2026-07-22 10:14:40 -03:00 committed by GitHub
commit 36ec2cc046
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View file

@ -479,6 +479,8 @@ export function applyCustomizationToDocument(
"--font-sans",
c.uiFont ? `"${c.uiFont}", ${DEFAULT_SANS_STACK}` : null,
);
// Custom interface fonts cascade into chat and opt out of its Inter tuning.
el.toggleAttribute("data-ui-font", Boolean(c.uiFont));
setVar(
"--font-heading",
c.headingFont ? `"${c.headingFont}", ${DEFAULT_HEADING_STACK}` : null,

View file

@ -633,6 +633,13 @@ html.no-font-smoothing body {
-moz-osx-font-smoothing: auto;
}
/* Match Inter's lighter macOS rendering. Keep 410 when smoothing is off or a
custom font reaches chat. */
html.render-linux:not(.no-font-smoothing):not([data-chat-font]):not([data-ui-font])
:is(.aui-assistant-message-root, .aui-user-message-root) {
font-weight: 350;
}
/* Chat font: only applies while a custom chat font is set. Elements with
explicit font utilities (headings, code) keep their own families. */
html[data-chat-font] .aui-root {

View file

@ -36,6 +36,13 @@ if (!rootElement) {
initializeLocale();
// Rasterization follows the browser OS, not the potentially remote server.
// This adjustment is calibrated for desktop Linux, so exclude Android.
const uaLower = navigator.userAgent.toLowerCase();
if (uaLower.includes("linux") && !uaLower.includes("android")) {
document.documentElement.classList.add("render-linux");
}
createRoot(rootElement).render(
<StrictMode>
<App />