codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

fix(file-icons): invert every devicon too dark for the dark themes #200

Merged
pat-s merged 1 commit from enh/devicon-dark-mode into v16.0/forgejo-codefloe 2026-10-01 12:45:27 +00:00
Owner

Invert every devicon that is too dark to see on the dark themes, instead of the hand-picked ten, and keep that set in sync with a test.

Follows #198, whose vendored SVGs and devicon-map.js this builds on.

Changes

  • web_src/js/features/devicon-map.js: DEVICON_DARK_INVERT_LIST now holds every vendored icon whose median pixel reaches less than 2:1 contrast against the dark surfaces, 41 icons instead of 10. Newly inverted: angular, arduino, astro, babel, cmake-plain, coffeescript, cplusplus-plain, elixir, fsharp, groovy, grpc, haskell, jetbrains, julia, less, lua, maven, ocaml, perl, pnpm, powershell, processing, ruby-original, solidity, sqlite, stylus, svelte, terraform-plain, vagrant, visualstudio and vscode.
  • web_src/js/features/file-icons.test.js: rasterize each vendored SVG with sharp, compute the median contrast against the forgejo-dark (and so codefloe-dark) and gitea-dark row surfaces, and require the list to equal the set under 2:1. Adding a mapping or bumping devicon can no longer leave a dark icon out, and an entry that is not dark fails too. The check takes about 150 ms.
  • README.md: extend the "Icons & UI" row.

Why 2:1 on the median pixel

I measured every vendored icon against the dark surfaces, plain and with the existing invert(0.8) hue-rotate(180deg) filter, and rendered both side by side in Chromium.

  • Near-black and navy icons sit between 1.0:1 and 1.8:1 and become clearly visible when inverted.
  • Saturated brand colours (erlang, mysql, postgresql, r, terraform-original, protractor, ruby-plain, heroku) sit between 2.0:1 and 3.0:1. They are readable as they are, and inverting them would wash out their colours.
  • All ten existing entries fall under the cutoff, so none is removed. The filter is unchanged and applies only on dark themes, as before.

Validation

  • Local instance with 46 file types: in dark mode 34 icons get the filter and all render, while light mode applies no filter. No request leaves the instance.
  • Removing lua-plain from the list makes the new test fail and name it.
  • vitest for file-icons.test.js and DiffFileTreeItem.test.js passes, and the frontend lint hook passes.

Follow-up

The thin mysql dolphin (2.25:1) stays dim but visible; it is the closest call above the line.

Invert every devicon that is too dark to see on the dark themes, instead of the hand-picked ten, and keep that set in sync with a test. Follows #198, whose vendored SVGs and `devicon-map.js` this builds on. ## Changes - `web_src/js/features/devicon-map.js`: `DEVICON_DARK_INVERT_LIST` now holds every vendored icon whose median pixel reaches less than 2:1 contrast against the dark surfaces, 41 icons instead of 10. Newly inverted: angular, arduino, astro, babel, cmake-plain, coffeescript, cplusplus-plain, elixir, fsharp, groovy, grpc, haskell, jetbrains, julia, less, lua, maven, ocaml, perl, pnpm, powershell, processing, ruby-original, solidity, sqlite, stylus, svelte, terraform-plain, vagrant, visualstudio and vscode. - `web_src/js/features/file-icons.test.js`: rasterize each vendored SVG with `sharp`, compute the median contrast against the forgejo-dark (and so codefloe-dark) and gitea-dark row surfaces, and require the list to equal the set under 2:1. Adding a mapping or bumping devicon can no longer leave a dark icon out, and an entry that is not dark fails too. The check takes about 150 ms. - `README.md`: extend the "Icons & UI" row. ## Why 2:1 on the median pixel I measured every vendored icon against the dark surfaces, plain and with the existing `invert(0.8) hue-rotate(180deg)` filter, and rendered both side by side in Chromium. - Near-black and navy icons sit between 1.0:1 and 1.8:1 and become clearly visible when inverted. - Saturated brand colours (erlang, mysql, postgresql, r, terraform-original, protractor, ruby-plain, heroku) sit between 2.0:1 and 3.0:1. They are readable as they are, and inverting them would wash out their colours. - All ten existing entries fall under the cutoff, so none is removed. The filter is unchanged and applies only on dark themes, as before. ## Validation - Local instance with 46 file types: in dark mode 34 icons get the filter and all render, while light mode applies no filter. No request leaves the instance. - Removing `lua-plain` from the list makes the new test fail and name it. - `vitest` for `file-icons.test.js` and `DiffFileTreeItem.test.js` passes, and the frontend lint hook passes. ## Follow-up The thin mysql dolphin (2.25:1) stays dim but visible; it is the closest call above the line.
pat-s force-pushed enh/devicon-dark-mode from f4e42ea3db
Some checks failed
testing / frontend-checks (pull_request) Failing after 2m59s
testing / backend-checks (pull_request) Successful in 17m15s
testing / test-e2e (pull_request) Has been skipped
testing / test-pgsql (1/4) (pull_request) Has been skipped
testing / test-pgsql (2/4) (pull_request) Has been skipped
testing / test-pgsql (4/4) (pull_request) Has been skipped
testing / test-unit (pull_request) Has been skipped
testing / test-pgsql (3/4) (pull_request) Has been skipped
to 2c5d633659
Some checks failed
testing / backend-checks (pull_request) Successful in 5m53s
testing / test-unit (pull_request) Successful in 10m43s
testing / frontend-checks (pull_request) Successful in 4m24s
testing / test-pgsql (1/4) (pull_request) Successful in 10m7s
testing / test-pgsql (2/4) (pull_request) Successful in 16m43s
testing / test-pgsql (4/4) (pull_request) Failing after 25m15s
testing / test-pgsql (3/4) (pull_request) Successful in 23m2s
testing / test-e2e (pull_request) Successful in 28m17s
2026-10-01 09:05:41 +00:00
Compare
pat-s force-pushed enh/devicon-dark-mode from 2c5d633659
Some checks failed
testing / backend-checks (pull_request) Successful in 5m53s
testing / test-unit (pull_request) Successful in 10m43s
testing / frontend-checks (pull_request) Successful in 4m24s
testing / test-pgsql (1/4) (pull_request) Successful in 10m7s
testing / test-pgsql (2/4) (pull_request) Successful in 16m43s
testing / test-pgsql (4/4) (pull_request) Failing after 25m15s
testing / test-pgsql (3/4) (pull_request) Successful in 23m2s
testing / test-e2e (pull_request) Successful in 28m17s
to 5dfb572933
Some checks failed
testing / test-unit (pull_request) Successful in 16m22s
testing / test-pgsql (1/4) (pull_request) Successful in 11m26s
testing / test-e2e (1/2) (pull_request) Successful in 20m31s
testing / test-pgsql (3/4) (pull_request) Successful in 12m42s
testing / test-pgsql (4/4) (pull_request) Has been cancelled
testing / frontend-checks (pull_request) Successful in 1m50s
testing / backend-checks (pull_request) Successful in 8m4s
testing / test-e2e (2/2) (pull_request) Successful in 21m37s
testing / test-pgsql (2/4) (pull_request) Successful in 7m55s
2026-10-01 11:20:08 +00:00
Compare
pat-s changed target branch from enh/vendor-devicons to v16.0/forgejo-codefloe 2026-10-01 11:53:21 +00:00
pat-s force-pushed enh/devicon-dark-mode from 5dfb572933
Some checks failed
testing / test-unit (pull_request) Successful in 16m22s
testing / test-pgsql (1/4) (pull_request) Successful in 11m26s
testing / test-e2e (1/2) (pull_request) Successful in 20m31s
testing / test-pgsql (3/4) (pull_request) Successful in 12m42s
testing / test-pgsql (4/4) (pull_request) Has been cancelled
testing / frontend-checks (pull_request) Successful in 1m50s
testing / backend-checks (pull_request) Successful in 8m4s
testing / test-e2e (2/2) (pull_request) Successful in 21m37s
testing / test-pgsql (2/4) (pull_request) Successful in 7m55s
to 63ebc29dba
All checks were successful
testing / test-pgsql (2/4) (pull_request) Successful in 9m6s
testing / test-pgsql (1/4) (pull_request) Successful in 10m53s
testing / frontend-checks (pull_request) Successful in 4m50s
testing / backend-checks (pull_request) Successful in 9m17s
testing / test-unit (pull_request) Successful in 16m18s
testing / test-pgsql (3/4) (pull_request) Successful in 11m39s
testing / test-e2e (1/2) (pull_request) Successful in 19m32s
testing / test-pgsql (4/4) (pull_request) Successful in 16m15s
testing / test-e2e (2/2) (pull_request) Successful in 20m29s
milestone / set (pull_request_target) Has been skipped
issue-labels / backporting (pull_request_target) Has been skipped
2026-10-01 11:55:05 +00:00
Compare
pat-s merged commit fe1eb745e7 into v16.0/forgejo-codefloe 2026-10-01 12:45:27 +00:00
pat-s deleted branch enh/devicon-dark-mode 2026-10-01 12:45:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!200
No description provided.