Skip to content

feat: add WGSL (WebGPU Shading Language) support#1724

Open
mvanhorn wants to merge 3 commits intoo2sh:mainfrom
mvanhorn:feat/wgsl-language-support
Open

feat: add WGSL (WebGPU Shading Language) support#1724
mvanhorn wants to merge 3 commits intoo2sh:mainfrom
mvanhorn:feat/wgsl-language-support

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Apr 3, 2026

Summary

Adds WGSL (WebGPU Shading Language) to onefetch's supported languages.

Changes

languages.yaml: Added WGSL entry with:

  • Type: programming
  • ASCII art: W letterform + WGSL abbreviation text
  • Color: blue (#4285F4) matching the WebGPU brand

tokei already supports WGSL for line counting (confirmed in tokei's languages.json).

References

Closes #1527

This contribution was developed with AI assistance (Claude Code).

Add WGSL to the supported languages list with ASCII art based on
the W letterform and WGSL abbreviation. Uses blue color matching
the WebGPU brand identity.

Closes o2sh#1527
Copy link
Copy Markdown
Collaborator

@spenserblack spenserblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see our contributing guidelines regarding AI usage: https://github.com/o2sh/onefetch/blob/main/CONTRIBUTING.md#ai-policy

Was there any human review before PR submission? Because the ASCII art looks incomprehensible to me TBH.

languages.yaml Outdated
Comment on lines +3216 to +3220
{0} WW GG SSSS LL
{0} WW GG SS LL
{0} WW W GG SSS LL
{0} WWWWWGG SS LL
{0} WW GGG SSSS LLLL
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This honestly just looks unreadable to me.

Traced from the actual W3C WebGPU logo SVG geometry
(webgpu-notext.svg), which is 5 blue triangles forming a W mark.

- 5-color blue gradient matching the SVG's triangle shading
  (#005A9C darkest to #0093FF brightest)
- 17 lines x 36 chars, within 25x40 bounds
- Asymmetric W shape faithful to the original logo proportions

Signed-off-by: Matt Van Horn <matt@mvanhorn.dev>
The right peak (Triangle 5) starts at y=87 in the SVG, same as
Triangle 1's top edge. Adjusted sampling threshold so the small
peak renders at the same row as the large triangle.

Signed-off-by: Matt Van Horn <matt@mvanhorn.dev>
@mvanhorn
Copy link
Copy Markdown
Author

You're right, and I apologize for the quality of the original submission. I should have caught that before opening the PR.

I've reworked the ASCII art from scratch, tracing it from the official W3C WebGPU SVG (the 5-triangle W mark). Used a 5-shade blue gradient to match the logo's triangle coloring. It passes cargo check and fits within bounds.

That said, I'm honestly not sure if it's good enough yet - the logo is an unusual shape for ASCII art and there's no existing reference to work from. Happy to take direction on what needs improving, or if you'd prefer a completely different approach.

Copy link
Copy Markdown
Collaborator

@spenserblack spenserblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good to me, I appreciate the work! Equilateral triangles are very hard to do in ASCII art, but you might have better luck approximating each "pixel" as 2 units tall and 1 unit wide, and so use 2 characters for horizontal alignment for each 1 character of vertical alignment.

      X
    XXXXX
  XXXXXXXXX
XXXXXXXXXXXXX

To be a bit more precise, I usually treat characters as 1 unit wide and roughly 1.5 units tall, but that fractional scaling can be difficult. Note how the above might feel a bit too wide, while the below doesn't have uniform scaling on each row.

      X
     XXX
   XXXXXXX
  XXXXXXXXX
XXXXXXXXXXXXX

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.

Language Support: add wgsl support

2 participants