Skip to content

web: add a frosted glass look with a toggle - #8647

Merged
unknwon merged 17 commits into
mainfrom
web-glass-style
Nov 17, 2026
Merged

unknwon merged 17 commits into
mainfrom
web-glass-style

Conversation

@unknwon

@unknwon unknwon commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Describe the pull request

Adds a frosted glass look to the web interface, following the Gogs 1.0 landing page: translucent panels with thin light edges over a soft color backdrop, in the light and dark themes. It is off by default, and the new "Glass mode" switch in the "Experiments" section of the settings menu, below the theme, turns it on. The choice is kept in localStorage.

With glass off, every page looks as it did before this change. Two exceptions: the code view with a file tree now uses the same layout as diffs (full window width with page padding, the navbar and repository header lined up with it, and the tree in a bordered box instead of against the window edge), and a contrast fix: destructive buttons in the dark theme now use dark text, since white on their coral fill was 2.85:1 and dark text is 6.95:1 (WCAG AA needs 4.5:1).

Link to the issue: n/a

How it works

  • An inline script in index.html puts glass-ui on <html> before the first paint, so there is no flash of the plain look. lib/glass.ts reads and stores the choice.
  • All glass tokens and rules are scoped under :root.glass-ui, so the plain palette is untouched.
  • Components opt in with marker classes that style nothing while glass is off:
    • glass for boxes, comments, cards, settings panels and the diff workspace
    • glass-list for lists of rows, e.g., the activity feed and repository lists
    • glass-section for a heading that labels a single box, so the heading becomes the panel's header row instead of floating above it
  • glass-bar for the navbar and the repository header
    • glass-control for outline buttons and segmented groups
    • glass-solid for filled buttons, which get a light sheen, a bright top edge, a ring and a soft glow like the landing page's call to action
  • The glass-ui: variant handles layout that only the glass look needs, e.g., padding around a list that is flat without glass.
  • Glass shadows keep Tailwind's ring layers, so keyboard focus stays visible on glass buttons.
  • Hover feedback on glass controls and rows uses --glass-control-hover and --glass-line-hover, inside @media (hover: hover) so touch screens keep no sticky hover.
  • Backdrop blur on dialogs, sheets, popovers and selects applies only with glass on.
  • With glass on, code in diffs and highlighted blocks sits on an inset field color, and file trees take the panel behind them.
  • With glass on, the code view toolbar with the breadcrumb is a glass bar. In both looks, the file tree box starts and ends with the file view. It sticks while the page scrolls, stops at the window height and keeps room for a few entries, and the file view's last panel grows to match on short pages.
  • With glass on, the file path and directory fields of the file editor and upload form form the header row of the panel that holds the editor or drop zone.

With glass on, only page titles, page tabs and toolbars sit on the backdrop. Sidebars, rendered documents and standalone forms sit on panels too, columns sit 16px apart, and a panel inside another panel flattens. Every hand-styled button or link and every toolbar dropdown is a glass control, while form fields keep an inset field look with a stronger edge for 3:1 boundary contrast.

web/DESIGN.md documents the pattern in its "Glass" section.

Screenshots

Glass on and off, repository home:

Glass on Glass off
Repo, light, glass on Repo, light, glass off
Repo, dark, glass on Repo, dark, glass off

Code view spans the page width like the diff view. With glass on, the breadcrumb toolbar is a glass bar. In both looks, the file tree panel starts and ends with the file view:

Glass on Glass off
File, dark, glass on File, dark, glass off
Folder, dark, glass on Folder, dark, glass off
Go file, dark, glass on Plain file, light, glass on

The switch in the Experiments section of the settings menu:

On Off
Settings menu, dark, glass on Settings menu, light, glass off

Filled buttons with glass on:

Dark Light
Destructive button, dark Destructive button, light

Sidebars and hand-styled controls with glass on: sidebars are glass panels, and buttons like "Browse files", commit SHA links and the issue filters are glass controls:

Repo sidebar, dark Issue sidebar, dark
Wiki page and sidebar, dark Profile sidebar and tabs, light
Commit, Browse files and Diff settings, light Issue filters, light

Sections and forms with glass on: headings and tabs become panel header rows, and standalone forms are panels:

Team members, dark Commits of a new pull request, dark
New milestone, dark New repository, dark

Other pages with glass on:

Issue, dark Dashboard, light
Diff, light Diff, dark
Branches, dark SSH keys, dark
Confirm dialog, dark

At 375px:

Dashboard, light, 375px Diff, dark, 375px
File, light, 375px

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code or have provided the test plan.
  • I have added an entry to CHANGELOG.

Test plan

  • Reviewed screenshots of 21 pages in light and dark, at 1440px with glass on and off, and 4 of them at 375px, over four review rounds.
  • The switch shows as switch "Glass mode" with aria-checked. Its choice survives a reload, and without a stored choice glass is off.
  • With glass off, computed styles of 15 pages in light and dark, plus a dialog, match a main build (excluding sizes that drift with font loading).
  • Nothing scrolls sideways at 375px.
  • A DOM check of 75 pages lists every heading, tab bar and form outside a panel. After the fixes, only page titles, page tabs and toolbars remain.
  • A DOM audit of 60 pages with glass on lists every element that draws its own full border without a glass marker. After the fixes, only form fields, code blocks, badges, avatars and alerts remain, as intended.
  • axe (WCAG 2.2 AA) finds no new violations with glass on or off. The color-contrast failures with glass off are the @pierre/diffs syntax colors, which main has too. With glass on, axe cannot measure contrast over translucent backgrounds, so that was checked by eye.
  • pnpm run lint, tsc and pnpm run build pass.

AI usage

Written with Amp, which made the change, captured and reviewed the screenshots, and ran the checks above.

unknwon added a commit that referenced this pull request Nov 17, 2026
The glass look is on by default and scoped under the glass-ui class on
<html>, so turning it off restores the plain look unchanged. Components
opt in with the glass, glass-list, glass-bar and glass-control marker
classes, and the glass-ui variant for layout that only glass needs.
Headings that label a single box, e.g., Activities on the dashboard,
floated alone on the glass backdrop. A glass-section turns the section
into one panel with the heading as its header row.
The glass fill of outline buttons outranked their hover:bg utility and
replaced it with a fill as faint as their rest state, so hovering showed
nothing in dark mode. Glass controls now brighten their fill and edge.
Glass is now off unless turned on in the settings menu. With glass off,
dialogs, sheets and popovers no longer blur or lighten their background,
and the branches and commits sections keep their square corners.
White on #ff6762 is 2.85:1. #0a0a0a on it is 6.95:1, matching how the dark
primary button pairs dark text with its light fill.
…lass look

Buttons and links styled by hand, e.g., Browse files, commit SHA links and
Diff settings, and the issue filter dropdowns now take glass-control. The
repository, issue, organization, profile, dashboard issues and wiki sidebars
and wiki pages sit on glass panels.
Profile tabs become the header row of the repository and activity panel,
dividers inside glass button groups use the glass edge, and sidebars sit
closer to the content beside them.
With glass on, team members, followers and the commits of a new pull request
become sections with header rows, standalone forms become panels, the code
view's file tree pane gets a frosted fill, nested panels flatten, and columns
sit 16px apart.
With a file tree, the code view now spans the window with the same page
padding as diffs, the navbar and repository header widen to line up with
it, and the tree sits in a bordered box instead of against the window edge.
@unknwon
unknwon merged commit 193a308 into main Nov 17, 2026
7 checks passed
@unknwon
unknwon deleted the web-glass-style branch November 17, 2026 06:30
@unknwon unknwon mentioned this pull request Nov 17, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant