Add contrasting border to black and white icons for theme-agnostic visibility #2833
Zak Siddiqui opened 2 days ago

Problem Statement

The current OneDev icon variants suffer from insufficient contrast when rendered against backgrounds that do not match their intended theme. The black icon becomes invisible on dark or dark-colored surfaces, and the white icon becomes invisible on light or light-colored surfaces. This is not limited to the OneDev application itself. It affects any integration point where the icon is embedded externally and the host environment uses a theme outside of our control.

Real-World Impact

  1. Identity portal: We use the OneDev icon as a launch target for users to SSO directly into OneDev. Users choose their own light or dark theme settings on the portal. We cannot enforce a single theme, so we cannot guarantee the icon will be visible.

  2. Browser themes: Users with non-standard browser themes (dark red, dark blue, purple, and similar) find the black icon nearly impossible to see. Switching to the white icon fixes dark theme users but breaks visibility for users on light browser themes.

  3. Temporary workaround: We replaced the icon with the old GitLab icon. The GitLab icon uses a range of contrasting colors, which makes it visible regardless of browser theme. This is not an ideal long-term solution since we are no longer running GitLab.

Proposed Solution

Add a high-contrast border outline to both the black and white icon variants. This way either variant can be rendered on any background color while remaining clearly identifiable.

Visual Description

Imagine the existing OneDev logo shape wrapped in a solid border that is approximately 8 to 12 percent of the icon width:

  • Black icon variant: Black fill with a thick white border outline around the entire shape. On dark backgrounds, the white border ensures the icon remains visible even when the black interior blends in.
  • White icon variant: White fill with a thick black border outline around the entire shape. On light backgrounds, the black border ensures the icon stands out even when the white interior blends in.

The border should follow the full outer contour of the logo, including any inner cutouts, so the silhouette is immediately recognizable at small sizes (16px, 24px, and 32px).

Benefits

  • Either icon variant becomes usable on any background color or theme
  • No theme detection logic required at integration points
  • Reduces accessibility friction for users on custom or non-standard themes
  • Minimal visual change to the existing brand identity

Suggested Implementation

  • Provide bordered versions alongside existing unbordered versions in the brand asset package
  • Name them clearly (e.g., onedev-black-bordered.svg, onedev-white-bordered.svg)
  • Use the bordered variants as defaults for externally shared or embedded use cases
  • Robin Shen commented 1 day ago

    @cah are you able to work on this? The icon in discussion is:

    server-core/src/main/java/io/onedev/server/web/img/logo.png

    server-core/src/main/java/io/onedev/server/web/img/logo-dark.png

  • Chief Work Horse commented 1 day ago

    Failed to do the job, please open workspace OD-6 for details

  • Robin Shen commented 1 day ago

    @cah retry

  • Chief Work Horse commented 1 day ago

    Confirmed the referenced assets are server-core/src/main/java/io/onedev/server/web/img/logo.png and server-core/src/main/java/io/onedev/server/web/img/logo-dark.png. I did not modify them on this checkout per the current instruction. The requested fix is an asset update for those PNGs: add opposite-color contrast outlines to the existing light/dark logo images, or provide bordered variants alongside them if we want to preserve the current unbordered assets.

  • Robin Shen commented 1 day ago

    Let's just go with simpler approach: add opposite-color contrast outlines to the existing light/dark logo images

  • Robin Shen changed fields 1 day ago
    Name Previous Value Current Value
    Assignee
    robin
    cah
  • Chief Work Horse referenced from pull request 1 day ago
  • Chief Work Horse commented 1 day ago

    Implemented in pr #77.

    Updated server-core/src/main/java/io/onedev/server/web/img/logo.png with a white contrast outline and server-core/src/main/java/io/onedev/server/web/img/logo-dark.png with a black contrast outline. I visually inspected both updated assets.

    I could not run the required Maven compile command in this workspace because java, javac, mvn, and a Maven wrapper are not available on PATH.

1/1
Type
Improvement
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2833
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover