Skip to content

Default tab colors invisible on light backgrounds (white-on-white) #13

@melvincarvalho

Description

@melvincarvalho

Symptom

Default `tabColor` is `rgba(255,255,255,0.5)` and `tabActiveColor` is `rgba(255,255,255,0.9)`. On any app with a light background (the bulk of the modern ecosystem — solid-apps.github.io's apps, third-party LOSOS apps), the tab text is invisible. Same for the `pane-tabs` border which defaults to `rgba(255,255,255,0.08)`.

The losos.org `vcard` example already works around this with per-app CSS:

```css
button.pane-tab { color: #888 !important; font-weight: 500 !important; }
button.pane-tab[aria-selected="true"] { color: #667eea !important; font-weight: 600 !important; }
```

The fact that the canonical demo overrides the defaults via `!important` is the strongest signal that the defaults are wrong for the actual usage pattern.

Reproduction

Open any of the bundled examples (e.g. `examples/dashboard/`) — tabs at the top are barely visible against the white background. The active-tab purple underline is the only visible cue that there are tabs at all.

Root cause

`losos/shell.js` lines 123-128 + 142:

```js
var tabColor = opts.tabColor || 'rgba(255,255,255,0.5)'
var tabActiveColor = opts.tabActiveColor || 'rgba(255,255,255,0.9)'
...
tabBar.style.cssText = '...border-bottom:1px solid rgba(255,255,255,0.08);...'
...
tab.style.borderBottomColor = opts.accentColor || '#7c3aed'
```

All three colors assume a dark background.

Proposed fix

Switch defaults to colors that work on both light AND dark backgrounds:

```diff

  • var tabColor = opts.tabColor || 'rgba(255,255,255,0.5)'
  • var tabActiveColor = opts.tabActiveColor || 'rgba(255,255,255,0.9)'
  • var tabColor = opts.tabColor || 'rgba(127,127,127,0.55)'
  • var tabActiveColor = opts.tabActiveColor || (opts.accentColor || '#7c3aed')
  • tabBar.style.cssText = 'display:flex;gap:0;border-bottom:1px solid rgba(255,255,255,0.08);overflow-x:auto;...'
  • tabBar.style.cssText = 'display:flex;gap:0;border-bottom:1px solid rgba(127,127,127,0.18);overflow-x:auto;...'
    ```

Three-line change. Behaviour:

  • Inactive tab: medium gray with transparency — readable on light or dark background. Translucent enough to feel secondary.
  • Active tab: defaults to the existing accent color (`#7c3aed` / customisable via `opts.accentColor`). Already used for the bottom-border underline, so visually consistent. Removes the redundant tabActiveColor parameter from the default path.
  • Tab bar border: same gray-with-transparency idea — visible on light, near-invisible on dark.

Apps that pass explicit `opts.tabColor` / `opts.tabActiveColor` continue to override exactly as before. Apps overriding via CSS `!important` (vcard) continue to win regardless.

Size impact

Tested locally:

raw gzip
Before 10,462 3,340
After 10,471 3,336
Delta +9 −4

Effectively zero. The fix doesn't grow shell.js (gzip actually shrinks by 4 bytes due to the new color values compressing slightly better).

Tested

Verified locally against `examples/dashboard/` (white background) and `drop-demo.html`: both render readable tabs with the purple-accent active state.

Happy to send a PR if accepted. Wanted to confirm the approach (and the `tabActiveColor` consolidation onto `accentColor` — a small API simplification) before pushing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions