Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Match sign-in icon sizes and render GitHub and Apple marks in pure black or white (#8769)

EthanHealy01ea922397fac2
diff --git a/frontend/src/editor/core/auth/ui/ProviderMark.tsx b/frontend/src/editor/core/auth/ui/ProviderMark.tsx
index 6ac0bbea6e..f0dbfefdea 100644
--- a/frontend/src/editor/core/auth/ui/ProviderMark.tsx
+++ b/frontend/src/editor/core/auth/ui/ProviderMark.tsx
@@ -1,7 +1,7 @@
import type { CSSProperties } from "react";
import { Icon } from "@editor/ui/Icon";
-import { oauthIconName } from "@editor/auth/ui/oauthIcons";
+import { MONOCHROME_MARKS, oauthIconName } from "@editor/auth/ui/oauthIcons";
interface ProviderMarkProps {
/** Provider icon filename, e.g. "google.svg". */
@@ -31,5 +31,16 @@ export function ProviderMark({
/>
);
}
- return <Icon name={name} className={className} style={style} title={label} />;
+ return (
+ <Icon
+ name={name}
+ className={className}
+ style={
+ MONOCHROME_MARKS.has(name)
+ ? { ...style, color: "var(--c-mark-mono)" }
+ : style
+ }
+ title={label}
+ />
+ );
}
diff --git a/frontend/src/editor/core/auth/ui/oauthIcons.test.ts b/frontend/src/editor/core/auth/ui/oauthIcons.test.ts
new file mode 100644
index 0000000000..7a08661553
--- /dev/null
+++ b/frontend/src/editor/core/auth/ui/oauthIcons.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from "vitest";
+
+import { MONOCHROME_MARKS, oauthIconName } from "@editor/auth/ui/oauthIcons";
+
+const marks = import.meta.glob<string>("../../icons/svg/third-party/*.svg", {
+ query: "?raw",
+ import: "default",
+ eager: true,
+});
+
+const providerMarks = Object.entries(marks).flatMap(([path, svg]) => {
+ const name = oauthIconName(path.split("/").pop() ?? "");
+ return name ? [{ name, svg }] : [];
+});
+
+// Every SVG paint property, whether set as an attribute or in a style
+// declaration. The name must be followed by `=` or `:` so fill-rule,
+// stroke-width and the like are not mistaken for paints.
+const PAINT =
+ /(?<![\w-])(fill|stroke|stop-color|flood-color|lighting-color|color)\s*[=:]\s*["']?([^"';}\s>]+)/g;
+const MONOCHROME_PAINTS = new Set(["currentColor", "none"]);
+
+function paintValues(svg: string): string[] {
+ return [...svg.matchAll(PAINT)].map((match) => match[2]);
+}
+
+describe("sign-in provider marks", () => {
+ it("covers every monochrome mark", () => {
+ const names = providerMarks.map((m) => m.name);
+ for (const name of MONOCHROME_MARKS) expect(names).toContain(name);
+ });
+
+ it.each(providerMarks)(
+ "$name follows its brand colour rule",
+ ({ name, svg }) => {
+ if (MONOCHROME_MARKS.has(name)) {
+ const paints = paintValues(svg);
+ expect(paints).toContain("currentColor");
+ for (const paint of paints) expect(MONOCHROME_PAINTS).toContain(paint);
+ } else {
+ expect(svg).not.toContain("currentColor");
+ }
+ },
+ );
+});
diff --git a/frontend/src/editor/core/auth/ui/oauthIcons.ts b/frontend/src/editor/core/auth/ui/oauthIcons.ts
index ae19a4d476..e8e25a2345 100644
--- a/frontend/src/editor/core/auth/ui/oauthIcons.ts
+++ b/frontend/src/editor/core/auth/ui/oauthIcons.ts
@@ -19,6 +19,17 @@ const ICON_BY_FILE: Record<string, IconName> = {
"authentik.svg": "authentik",
};
+/**
+ * Marks drawn in currentColor and pinned to pure black or white per theme.
+ * Only owners whose guidelines allow exactly that belong here: GitHub's
+ * Invertocat ships in black or white, and Sign in with Apple requires a black
+ * or white logo. Every other mark keeps its own colours in both themes.
+ */
+export const MONOCHROME_MARKS: ReadonlySet<IconName> = new Set([
+ "github",
+ "apple",
+]);
+
/** The registry mark for a provider icon filename, or null when none is bundled. */
export function oauthIconName(file: string): IconName | null {
return Object.hasOwn(ICON_BY_FILE, file) ? ICON_BY_FILE[file] : null;
diff --git a/frontend/src/editor/core/icons/svg/third-party/apple.svg b/frontend/src/editor/core/icons/svg/third-party/apple.svg
index 6695807b0a..57948d921e 100644
--- a/frontend/src/editor/core/icons/svg/third-party/apple.svg
+++ b/frontend/src/editor/core/icons/svg/third-party/apple.svg
@@ -1,3 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
- <path fill="currentColor" d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701" />
+ <g transform="translate(2 2) scale(0.8333)">
+ <path fill="currentColor" d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701" />
+ </g>
</svg>
diff --git a/frontend/src/editor/core/icons/svg/third-party/github.svg b/frontend/src/editor/core/icons/svg/third-party/github.svg
index d2cc8c7362..09fd93bf5a 100644
--- a/frontend/src/editor/core/icons/svg/third-party/github.svg
+++ b/frontend/src/editor/core/icons/svg/third-party/github.svg
@@ -1,5 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none">
- <g transform="translate(2 2.2703) scale(0.5405)">
+ <g transform="translate(-0.5958 -0.0442) scale(0.6809)">
<path fill="currentColor" d="M18.5 3.3125C16.5712 3.3125 14.6613 3.6924 12.8793 4.43052C11.0974 5.16864 9.47823 6.25051 8.11437 7.61437C5.35993 10.3688 3.8125 14.1046 3.8125 18C3.8125 24.4919 8.02781 29.9997 13.8588 31.9531C14.5931 32.0706 14.8281 31.6153 14.8281 31.2187V28.7366C10.7597 29.6178 9.89312 26.7684 9.89312 26.7684C9.2175 25.0647 8.26281 24.6094 8.26281 24.6094C6.92625 23.6987 8.36562 23.7281 8.36562 23.7281C9.83437 23.8309 10.6128 25.2409 10.6128 25.2409C11.8906 27.4734 14.0497 26.8125 14.8869 26.46C15.0191 25.5053 15.4009 24.8591 15.8122 24.4919C12.5516 24.1247 9.12937 22.8616 9.12937 17.2656C9.12937 15.6353 9.6875 14.3281 10.6422 13.2853C10.4953 12.9181 9.98125 11.3906 10.7891 9.40781C10.7891 9.40781 12.0228 9.01125 14.8281 10.9059C15.9884 10.5828 17.2516 10.4212 18.5 10.4212C19.7484 10.4212 21.0116 10.5828 22.1719 10.9059C24.9772 9.01125 26.2109 9.40781 26.2109 9.40781C27.0188 11.3906 26.5047 12.9181 26.3578 13.2853C27.3125 14.3281 27.8706 15.6353 27.8706 17.2656C27.8706 22.8762 24.4338 24.11 21.1584 24.4772C21.6872 24.9325 22.1719 25.8284 22.1719 27.1944V31.2187C22.1719 31.6153 22.4069 32.0853 23.1559 31.9531C28.9869 29.985 33.1875 24.4919 33.1875 18C33.1875 16.0712 32.8076 14.1613 32.0695 12.3793C31.3314 10.5974 30.2495 8.97823 28.8856 7.61437C27.5218 6.25051 25.9026 5.16864 24.1207 4.43052C22.3387 3.6924 20.4288 3.3125 18.5 3.3125Z"/>
</g>
</svg>
diff --git a/frontend/src/editor/core/theme/colors.css b/frontend/src/editor/core/theme/colors.css
index 43de570fcf..953bb644c7 100644
--- a/frontend/src/editor/core/theme/colors.css
+++ b/frontend/src/editor/core/theme/colors.css
@@ -20,6 +20,8 @@ html[data-app-theme="light"] {
--c-text-muted: var(--p-gray-600);
--c-text-subtle: var(--p-gray-550);
--c-text-on-primary: var(--p-white);
+ /* Brand marks whose owners permit only pure black or white (GitHub, Apple). */
+ --c-mark-mono: var(--p-black);
--c-btn-solid: var(--c-text);
--c-btn-inverse: var(--p-snow);
@@ -162,6 +164,7 @@ html[data-app-theme="midnight"] {
--c-text-muted: var(--p-zinc-200);
--c-text-subtle: var(--p-zinc-250);
--c-text-on-primary: var(--p-white);
+ --c-mark-mono: var(--p-white);
/* Accent used as TEXT on dark surfaces: a lighter step for 4.5:1. */
--c-accent-text: var(--p-blue-400);
--c-btn-solid: var(--c-text);
@@ -345,6 +348,7 @@ html[data-app-theme="custom"][data-mantine-color-scheme="dark"] {
--c-text: var(--p-snow);
--c-text-muted: var(--p-zinc-200);
--c-text-subtle: var(--p-zinc-250);
+ --c-mark-mono: var(--p-white);
--c-btn-solid: var(--c-text);
--c-btn-inverse: var(--p-ink);
--c-btn-secondary: var(--p-c-1a1a1d);
diff --git a/frontend/src/editor/proprietary/auth/ui/auth.css b/frontend/src/editor/proprietary/auth/ui/auth.css
index e1b8893385..b825a96264 100644
--- a/frontend/src/editor/proprietary/auth/ui/auth.css
+++ b/frontend/src/editor/proprietary/auth/ui/auth.css
@@ -794,11 +794,6 @@
box-shadow: none;
}
-/* ── Dark-mode icon inversion for monochrome OAuth logos ────────────── */
-[data-mantine-color-scheme="dark"] .oauth-icon--github {
- filter: invert(1);
-}
-
/* ── Icon+label group — keeps icons vertically aligned across buttons ── */
.oauth-btn-group {
display: inline-flex;
diff --git a/frontend/src/editor/saas/routes/Login.tsx b/frontend/src/editor/saas/routes/Login.tsx
index 379571d4a2..df3a90164d 100644
--- a/frontend/src/editor/saas/routes/Login.tsx
+++ b/frontend/src/editor/saas/routes/Login.tsx
@@ -327,12 +327,8 @@ export default function Login() {
<span className="oauth-btn-group">
<Icon
name="link"
- style={{
- width: "1.75rem",
- height: "1.75rem",
- marginRight: "0.5rem",
- flexShrink: 0,
- }}
+ className="oauth-icon-medium"
+ style={{ marginRight: "0.5rem", flexShrink: 0 }}
/>
<span className="oauth-btn-label">
{t("login.useMagicLink", "Use magic link")}
diff --git a/frontend/src/editor/saas/routes/authShared/saas-auth.css b/frontend/src/editor/saas/routes/authShared/saas-auth.css
index 23067d77f9..cb0d43558f 100644
--- a/frontend/src/editor/saas/routes/authShared/saas-auth.css
+++ b/frontend/src/editor/saas/routes/authShared/saas-auth.css
@@ -122,11 +122,6 @@
text-align: center;
}
-/* ── Dark-mode icon inversion for monochrome OAuth logos ────────────── */
-[data-mantine-color-scheme="dark"] .oauth-icon--github {
- filter: invert(1);
-}
-
/* ── Icon helpers inside oauth-button-fullwidth ─────────────────────── */
.auth-at-icon {
font-size: 1.25rem;