fix(file-icons): invert every devicon too dark for the dark themes #200
No reviewers
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codefloe/forgejo-codefloe!200
Loading…
Reference in a new issue
No description provided.
Delete branch "enh/devicon-dark-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.jsthis builds on.Changes
web_src/js/features/devicon-map.js:DEVICON_DARK_INVERT_LISTnow 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 withsharp, 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.Validation
lua-plainfrom the list makes the new test fail and name it.vitestforfile-icons.test.jsandDiffFileTreeItem.test.jspasses, 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.
f4e42ea3db2c5d6336592c5d6336595dfb5729335dfb57293363ebc29dba